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

How to retrieve value in xsl:value variable??

Subject: How to retrieve value in xsl:value variable??
From: "Lucie C. Chan" <lcchan@xxxxxxxxxx>
Date: Sat, 19 Feb 2000 16:19:03 -0500
xsl value variable
I'm new to XSL, and thought someone on the Net can give me some help on
this.

I have the following elements in my x.xml file. Some of the information
in the file will be extracted and used
in a text doc:

<PERIODIC_TABLE>
  <ATOM STATE="GAS">
    <NAME>Hydrogen</NAME>
    <SYMBOL>H</SYMBOL>
  </ATOM>
</PERIODIC_TABLE>

----------------------------------------------------------------------------------------------

Desired output: Information for: Hydrogen
----------------------------------------------------------------------------------------------

So I defined the following in my x.xsl file:

<xsl:template match="/"><xsl:apply-templates/></xsl:template>
<xsl:template match="ATOM">

<!-- define a varialbe -->
<xsl:variable name='atomname'>
<xsl:value-of select="NAME"/>
</xsl:variable>

<!-- print out some information -->
Information for: <xsl:value-of select='$atomname'/>
Name:             <xsl:value-of select='$atomname'/>
<!-- end of output -->

</xsl:template>
</xsl:stylesheet>
-----------------------------------------------------
The reson I defined a variable "atomname" is because I want to use it in
several places in my doc. However,
I would like to be able to retrieve the value using $atomname without
invoking <xsl:value> call, i.e. is
there a way that I can print my information in the following way in my
x.xsl file?

<!-- print out some information -->
Information for: '$atomname'
Name:              '$atomname'
<!-- end of output -->

This didn't work ($atomname is printed instead of the value stored in
the variable) when I tried to using to process my
files using a XSLT processor.

Thanks for any help/suggestion, etc. If possible, email reply preferred.



Lucie C. Chan <lcchan@xxxxxxxxxx>


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


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.