This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Parameter/Variable values as attribute values
- To: xsl-list at mulberrytech dot com
- Subject: Parameter/Variable values as attribute values
- From: Zeljko Rajic <Zeljko dot Rajic at brokat dot com>
- Date: Tue, 28 Nov 2000 10:46:42 +0100
- Organization: Brokat AG
- Reply-To: xsl-list at mulberrytech dot com
Hi !
This maybe is some kind of beginners question, but I couldn't find any resource
that tells my how to do it. What I want to do is to assign a parameter or
variable value to an attribute. This is what I currently try to do:
<xsl:stylesheet version="1.0" ...... />
<xsl:param name="file"/>
<xsl:variable name="newFile">myFilename</xsl:variable>
<xsl:template match="/">
Param: <xsl:value-of select="$file"/>
Variable: <xsl:value-of select="$newFile"/>
<saxon:output file="$file" method="xml" version="1.0" encoding="UTF-8"
indent="yes">
<xsl:copy-of select="."/>
</saxon:output>
</xsl:template>
</xsl:stylesheet>
I'm using the Saxon 5.5.1 XSL processor (instant version) and call it like this:
saxon.exe TheSourceDoc.xml Transformer.xsl file=myFilename
The output I get looks like this:
Param: myFilename
Variable: myFilename
So it seems the parameter has been passed correctly. But unfortunately the
parameter nor variable is evaluated within the attribut of the <saxon:output>
tag, thus a file with the name "$file" is created which contains the copy of the
original document.
As I didn't find any information (neither online nor in any XSL book) on how to
use/access parameter or variable values within tag attributes I hope that
somebody from this list can tell me.
Any help is appreciated!
With best regards,
Zeljko
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list