[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Parameterizing an XML using a XSLT

Subject: RE: Parameterizing an XML using a XSLT
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 9 Apr 2003 20:52:55 +0100
xslt reference preceding sibling
> 1. It can place the placeholder in the //Status/Reference 
> node if it has a sibling of Command=Add but I cannot figure 
> out a way of adding an index number to the placeholder that 
> increases sequentially for each match. Both
> position() and <xsl:number > do not work with the transform 
> constructed this way.

<xsl:number level="any" 
  count="Body/Status/Reference[preceding-sibling::Command='Add']"/>

should do the trick.

> 
> 2. How can I use the same placeholder in the 
> //Map/MapItem/Target/Loc if infact the number matches the one 
> in the //Status/Reference tag above it.

<xsl:template match="Map/MapItem/Target/Loc">
 <xsl:choose>
   <xsl:when test=". = ../../../preceding-sibling::Status[1]/Reference">
     <xsl:text>ref</xsl:text>
     <xsl:for-each select =
"../../../preceding-sibling::Status[1]/Reference">
        <xsl:number level="any" 
  count="Body/Status/Reference[preceding-sibling::Command='Add']"/>
     </
   </
   <xsl:otherwise> ??? (you don't say) </xsl:otherwise>
  </
</

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.