OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Reference value of parent node within template match?

[ Lists Home | Date Index | Thread Index ]
  • To: "Paul Delange" <Paul.Delange@cami.ca>, <xml-dev@lists.xml.org>
  • Subject: RE: [xml-dev] Reference value of parent node within template match?
  • From: "Xia Li" <xli@galdosinc.com>
  • Date: Fri, 20 Jan 2006 16:27:20 -0800
  • Thread-index: AcYeGzrA5T15o6ppRhGBmlJ3xk8+bAABXx0Q
  • Thread-topic: [xml-dev] Reference value of parent node within template match?

I am not sure I understand your question correctly. But if your current
node is the <VENDOR_LOC> and you want to select the value of
<DEFAULT_LOC>, you may try

<xsl:if test="VNDR_LOC =  ../../DEFAULT_LOC">


<xsl:if test="VNDR_LOC = ../preceding-sibling::DEFAULT_LOC">


-----Original Message-----
From: Paul Delange [mailto:Paul.Delange@cami.ca] 
Sent: Friday, January 20, 2006 3:40 PM
To: xml-dev@lists.xml.org
Cc: paul.delange@cami.ca
Subject: [xml-dev] Reference value of parent node within template match?


In puesdo-English, I need to output a <TERMS_CD>00</TERMS_CD> because,
the XML below, DEFAULT_LOC = 1, therefore the payment terms for the
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>
        <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>
        <VNDR_VAT_RGSTRN class="R">

When I apply a template I can't reference a value from a parent node -
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>

If someone can solve this for me, there will forever be a giant in my

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>


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS