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

RE: Reference value of parent node within template match?


xsl reference parent node
From VENDOR_LOC you can access DEFAULT_LOC as

../preceding-sibling::DEFAULT_LOC

or if you prefer,

../../DEFAULT_LOC

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Paul Delange [mailto:Paul.Delange@c...] 
> Sent: 20 January 2006 23:40
> To: xml-dev@l...
> Cc: paul.delange@c...
> Subject:  Reference value of parent node within 
> template match?
> 
> Hi!
> 
> In puesdo-English, I need to output a <TERMS_CD>00</TERMS_CD> 
> because, is
> the XML below, DEFAULT_LOC = 1, therefore the payment terms 
> for the default
> location are 00.
> 
>       <VENDOR class="R">
>         <VENDOR_ID IsChanged="Y">000000001</VENDOR_ID>
>         <DEFAULT_LOC IsChanged="Y">1</DEFAULT_LOC>
>         <VNDR_LOC_SCROL class="R">
>           <VENDOR_LOC class="R">
>             <VNDR_LOC IsChanged="Y">1</VNDR_LOC>
>             <PYMNT_TERMS_CD IsChanged="Y">00</PYMNT_TERMS_CD>
>           </VENDOR_LOC>
>         </VNDR_LOC_SCROL>
>         <VNDR_LOC_SCROL class="R">
>           <VENDOR_LOC class="R">
>             <VNDR_LOC IsChanged="Y">3</VNDR_LOC>
>             <PYMNT_TERMS_CD IsChanged="Y">99</PYMNT_TERMS_CD>
>           </VENDOR_LOC>
>         </VNDR_LOC_SCROL>
>         <VNDR_VAT_RGSTRN class="R">
>           <VAT_RGSTRN_ID/>
>         </VNDR_VAT_RGSTRN>
>       </VENDOR>
> 
> When I apply a template I can't reference a value from a 
> parent node - or
> can I?
> 
> <xsl:apply-templates select ="VENDOR/VNDR_LOC_SCROL/VENDOR_LOC"/>
> ...
> <xsl:template match="VENDOR_LOC">
>    <xsl:if test="VNDR_LOC = "The parent value of DEFAULT_LOC">
>       <test><xsl:value-of select="PYMNT_TERMS_CD" /></test>
>    </xsl:if>
> </xsl:template>
> 
> If someone can solve this for me, there will forever be a 
> giant in my eyes
> ;o)
> 
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
> 
> 



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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.