|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] question on preceding nodes
Hi list I would like to understand the use of preceding axis relative to my problem. My xml looks like <BOXES> <BOX number="1"> <C name="pencil"/> <C name="pen"/> <C name="eraser"/> </BOX> <BOX number="2"> <C name="pen"/> <C name="razor blade"/> <C name="highlighter"/> <C name="post_it_notes"/> </BOX> .... other BOXes </BOXES> In my xsl i would like to display the names of C in BOX number 2 as "pen_2" because it's found in BOX number 2 and there is already a pencil in BOX number 1 (to make the name unique). For the pen found in BOX number 1 I just want to display "pen". If the tenth BOX has a "pen"s also, it should be displayed as "pen_10" and so forth. so I have a line to check for uniqueness like this: <xsl:template match="C"> <xsl:for-each select="C"> <xsl:choose> <xsl:when test="preceding::/*/*/C[@name=current()/@name]"> <xsl:value-of select="current()/@name"/>_<xsl:value-of select="../BOX/@number"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="current()/@name"/> </xsl:otherwise> </xsl:for-each> </xsl:template> but this never produces the "_2" in "pen_2". Any tip? 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
|






