[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

Subject: Re: When first Node add a style in XSL
From: Michael Ludwig <mlu@xxxxxxxxxxxxx>
Date: Fri, 16 May 2008 16:22:25 +0200
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: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"
  <xsl:output method="text"/>
  <xsl:template match="/">
    <xsl:apply-templates select="//Elm"/>
  <xsl:template match="Elm[1]">
    <xsl:text>first one&#10;</xsl:text>
  <xsl:template match="Elm">
    <xsl:text>not the first one&#10;</xsl:text>


Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.