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!

xpath, variables, document

Status
Not open for further replies.

Crisps

Programmer
Sep 28, 2006
26
US
Hi,

I have been working on a larger issue and have narrowed down the issue to a very small one.

I have a variable called $data_path. I am trying to read a document called mydata.xml which looks like.

<root>
<a>Hello world</a>
</root>

the $data_path variable contains the string "/root/a" (this can be tweaked if needed).

How do I read the Hello World string from the file. I am trying to do something like

<xsl:variable name="new" select="document('mydata.xml')$data_path"/>

but this does not quite work. If I replace this with the string

<xsl:variable name="new" select="document('mydata.xml')/root/a"/>

it works fine. Now just to get it to work with the variable.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top