|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xsl:if to separate child elements
Hello, I am somehow really stuck trying to separate out different child elements using <xsl:if>. Please help with the following situation if possible: Here is an example of the type of xml I am working with - 1 help element with multiple heltext and helpexample elements: <category name="science"> <help> <helptext> This is a descriptive note </helptext> <helpexample> This is an example </helpexample> <helptext> This is another line of text </helptext> </help> </category> I would like to do a for-each to be able to print out all helptext and helpexample elements in sequence, but I would like to give a different style to helptext vs helpexample (<pre></pre>). There may be unequal numbers of these elements. I am trying: <xsl:for-each select="help/helptext|help/helpexample"> <xsl:if test="helptext"/> <pre> <xsl:value-of select="."/> </pre> <xsl:if test="position() mod 2=0"> <pre> <xsl:value-of select="."/> </pre> </xsl:if> </xsl-if> </xsl:for-each> </xsl:if> </xsl:for-each> the position() mod 2 part works, but I dont have any guarantee that the particular element will always be in the even position. I would appreciate any help... Thank You, Sincerely, Mila Mitra pmitra@xxxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








