[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Accessing xml node data using variable

Subject: Accessing xml node data using variable
From: "Sanket Pattekar" <sanket.pattekar@xxxxxxxxx>
Date: Sat, 22 Apr 2006 11:10:38 +0200
using variable data
Hi

I have a xml file called hello.xml that looks like
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="hello.xsl"?>
<root>
<greeting>Hello world.</greeting>
<title-en>News Title English</title-en>
<title-nl>News Title Dutch</title-nl>
</root>

Then I have the stylesheet called hello.xsl that looks like
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:variable name="lang" select="'en'" />
	<xsl:variable name="MyTitleName" select="concat('title-',$lang)"/>

	<xsl:template match="/">
		<head><title>Greeting</title></head>
			<body>
			<p>Words of greeting:<br/>
				<b><i><u><xsl:value-of select="root/greeting"/></u></i></b><br/>
				<b><i><u><xsl:value-of select="root/title-en"/></u></i></b><br/>
				<b><i><u><xsl:value-of select="root/title-nl"/></u></i></b><br/>
				<b><i><u><xsl:value-of select="root/{$MyTitleName}"/></u></i></b><br/>
			 </p>
 			</body>
	</xsl:template>
</xsl:stylesheet>

Now I want to create a variable called 'MyTitleName' in the
stylesheet, that refrences my xml node. Any suggestion would be
welcome.

Sanket

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.