M
Murtaza Tinwala
Hi mates,
I am having the following problem in XSLT. I have the following three
variables which I receive from an XML document.
$xmlfile = "doc.xml"
$repeatpath = "/root/person"
$path = "name"
Suppose, the file doc.xml containls the following XML document:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<person>
<name>Murtaza</name>
<surname>tinwala</surname>
</person>
<person>
<name>Rishit</name>
<surname>udani</surname>
</person>
<person>
<name>Nilesh</name>
<surname>ruparelia</surname>
</person>
</root>
From $xmlfile, I am loading the external XML document ( <xsl:variable
name="xmldatabase" select="document($xmlfile)"/>). The variable
$repeatpath contains the Xpath expression on which I have to run a
XSLT for-each loop. The variable $path contains the node, which I
have to output somewhere.
Now, the problem is I want to express Xpath expression in string
format like the following way:
<xsl:for-each select="$xmldatabase/$repeatpath">
But, that is not possible, because we cannot use variables for select
expressions. How should I solve this problem?
Murtaza Tinwala.
I am having the following problem in XSLT. I have the following three
variables which I receive from an XML document.
$xmlfile = "doc.xml"
$repeatpath = "/root/person"
$path = "name"
Suppose, the file doc.xml containls the following XML document:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<person>
<name>Murtaza</name>
<surname>tinwala</surname>
</person>
<person>
<name>Rishit</name>
<surname>udani</surname>
</person>
<person>
<name>Nilesh</name>
<surname>ruparelia</surname>
</person>
</root>
From $xmlfile, I am loading the external XML document ( <xsl:variable
name="xmldatabase" select="document($xmlfile)"/>). The variable
$repeatpath contains the Xpath expression on which I have to run a
XSLT for-each loop. The variable $path contains the node, which I
have to output somewhere.
Now, the problem is I want to express Xpath expression in string
format like the following way:
<xsl:for-each select="$xmldatabase/$repeatpath">
But, that is not possible, because we cannot use variables for select
expressions. How should I solve this problem?
Murtaza Tinwala.