Subject: xsl:if to separate child elements From: pmitra <pmitra@xxxxxxxxxxxxxxxxx> Date: Mon, 25 Sep 2000 18:35:05 -0700 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: copy-of, variables, and paramet, Kay Michael | Thread | Re: xsl:if to separate child elemen, John E. Simpson |
Re: (2 xpath questions), John E. Simpson | Date | Re: xsl:if to separate child elemen, John E. Simpson |
Month |