Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 5th, 2003, 05:49 PM
Registered User
 
Join Date: Nov 2003
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default numbering

hi all,
      here is xslt which is always giving me the count value as 0. This is extracted from the sams reply to my earlier numbering problem (thank you Sam :-). I have changed little bit according to my purpose.

<xsl:template match="mml:mo[.='(']">
   <xsl:choose>
       <xsl:when test="text() = '('">
    <xsl:variable name="moWithParen" select="count(preceding::mo[text() = '('])"/>
     <prompt><goto next = "{$moWithParen}"/></prompt>

     <prompt></form></prompt>

   (Also please note here that I want </form> within the prompts. and at this point it is giving me error that there is no matching <form> found. I should be able to output the above line without any error)

         <prompt><form name = "{$moWithParen}"></prompt>

    (A similar kind of error found here.. The error says I should have the form closed but my requirement is that i shouldnt and should output as it is shown in above line)

    </xsl:when>
        <xsl:otherwise/>
    </xsl:choose>
</xsl:template>

kindly help is needed
 Thank you
 gs

Reply With Quote
  #2 (permalink)  
Old November 5th, 2003, 06:39 PM
Authorized User
 
Join Date: Oct 2003
Location: , PA, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The errors are showing up because you are attempting to output something that is not well-formed.

Is it really a requirement that the "form" start tag and end tag appear within prompt elements separately?

I will slightly modify a reply from Mr. Kay (by only changing "tr" to "form") from the October 2001 archives "HTML Forced Output" dealing with a similar situation:

"A stylesheet transforms an input tree to an output tree, and then serializes the result as XML or HTML. Clearly the tree can't contain half a node.

You can cheat by using
 <xsl:text disable-output-escaping="yes">&lt;/form&gt;</xsl:text>

but you need to be aware that you are not using the language the way it was intended to be used, and that this will limit the options on deploying the stylesheet. I'd prefer to look back at your design, and correct it at source. There must be a better way of doing this."

Good luck,

...sam


Reply With Quote
  #3 (permalink)  
Old November 6th, 2003, 06:04 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

And if your match is:
Code:
match="mml:mo[.='(']">
There is little point in then testing if the text equals "(":
Code:
<xsl:when test="text() = '('">
as this is always true.

Joe (MVP - xml)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Numbering - For each Navy1991_1 XSLT 3 July 2nd, 2008 07:56 AM
Numbering in XSLT Angel1221 XSLT 1 June 10th, 2008 05:07 PM
Sequential numbering help gear1 Access 1 April 9th, 2007 06:31 AM
Page numbering athanatos XSLT 4 May 13th, 2005 06:12 PM
XSL numbering be782524 XSLT 2 August 5th, 2003 05:14 AM



All times are GMT -4. The time now is 05:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.