[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: When first Node add a style in XSL
Perfect, thank you. Too bad I had to create another template but I understand. -----Original Message----- From: Michael Ludwig [mailto:mlu@xxxxxxxxxxxxx] Sent: Friday, May 16, 2008 10:22 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: When first Node add a style in XSL Dan Acuff schrieb: > How do I put the proper test in for the first Node I encounter, add a > top border:? > > <xsl:template match="category"> > <xsl:choose> > <xsl:when test="first::category"> Well, "first" is not an XPath axis. Maybe you're confusing XSLT and CSS? If you want to test whether an element node is the first one in a given node-set, you can proceed as follows: <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:apply-templates select="//Elm"/> </xsl:template> <xsl:template match="Elm[1]"> <xsl:text>first one </xsl:text> </xsl:template> <xsl:template match="Elm"> <xsl:text>not the first one </xsl:text> </xsl:template> </xsl:transform> Michael
|
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
|