Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with the copy-of

Status
Not open for further replies.

bchagnon

Programmer
Oct 3, 2002
4
0
0
CA
Hello!

I'm trying to create my Xpath in a variable and give to the copy-of function. The problem is the xml result. The xpath is not execute by the copy-of function, the xpath is displayed on the screen! What's i'm doing wrong???

I'm doing it because my xpath is normally in another xml file.

This is the xsl code
Thanks!

<xsl:template match=&quot;/&quot; >
<xsl:variable name=&quot;sValue&quot;>Purchases</xsl:variable>
<Days>
<xsl:for-each select=&quot;/Days/Day&quot;>
<Day>
<xsl:copy-of select = &quot;Date&quot; />
<Restaurants>
<xsl:for-each select=&quot;/Days/Day/Restaurants/Restaurant/Data&quot;>
<Restaurant>
<xsl:copy-of select = &quot;../RestaurantId&quot; />
<Data>
--> <xsl:copy-of select = &quot;$sValue&quot; />
<xsl:copy-of select = &quot;Sales&quot; />
</Data>
</Restaurant>
</xsl:for-each>
</Restaurants>
</Day>
</xsl:for-each>
</Days>
</xsl:template>
 
I believe xpaths are resolved at compile time not runtime. The best you can do is an xpath with a predicate of the form [name()=$svalue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top