Parameter/Variable values as attribute values

Subject: Parameter/Variable values as attribute values
From: Zeljko Rajic <Zeljko.Rajic@xxxxxxxxxx>
Date: Tue, 28 Nov 2000 10:46:42 +0100
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"
         <xsl:copy-of select="."/>


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,

 XSL-List info and archive:

Current Thread