xsl-list
[Top] [All Lists]

variable in xpath

2002-11-14 22:33:36
I have two xml files with exactly similar hierarchy, but for a few different element nodes. Something like the following:

File1.xml
<element>
   <child>
      <a>
      <b>
   </child>
</element>

File2.xml
<element>
   <child>
     <a>
      <adesc>
     </a>
   </child>
</element>

I have a variable $path that holds an element's (in File1) xpath as if it was assinged by one the following:

<xsl:variable name="path" select="'element/child/a'"/>

How do I obtain and copy the node <adesc> of File2 using the above $path variable? Something like the below one:

<xsl:template match="node()">
   <xsl:copy-of select="document(File2.xml)/$path.."/>
</xsl:template>

Output has to be smth like this:
<element>
   <child>
     <a>
      <adesc>
     </a>
     <b>
   </child>
</element>

Thanks,
Kalyan

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



<Prev in Thread] Current Thread [Next in Thread>