[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: question on preceding nodes
Hi John,
The XPath Location Path in the test <xsl:when test="preceding::/*/*/C[@name=current()/@name]"> isn't correct. It shouldn't parse at all (you should get a compile-time error). Try, simply, preceding::C[@name=current()/@name] Since any location path step must be constructed as axisname::nodetest[optionalpredicate] and yours has no node test, but rather '/*/*/C' which looks like a location path on its own (composed of three steps, child:: axis implicit in each step, node tests '*', '*' and 'C'). If this use of jargon suggests to you that studying the anatomy of XPath may be worth the time spent -- you're right. And in general you need to clean up, as in something like <xsl:template match="C"> <xsl:value-of select="@name"/> <xsl:if test="preceding::C[@name=current()/@name]"> <xsl:text>_</xsl:text> <xsl:value-of select="../@number"/> </xsl:if> </xsl:template> I hope that helps-- Cheers, Wendell At 06:07 PM 3/31/2003, you wrote: <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> ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== 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
|