Jump to content

Xslt: Use Of External Parameter With Altova Or Gestalt


mfran2002

Recommended Posts

hi,I need to use external parameters from command line with altova or gestalt xslt transformationI don't know the way (the syntax) to refer my parameter into the stylesheet:example, my command line:AltovaXML.exe /xslt2 ./mystylesheet.xsl /in myfile /param paramname=paramvalueinto the stylesheet:..<xsl:attribute name="value" select="paramname"/>...how can I refer my paramname into the stylesheet?may you please help me?

Link to comment
Share on other sites

That's just it.. you don't refer to parameters in the stylesheet from the program. It's the other way around - the program refers to parameters from the stylesheet.So, you need to either have

AltovaXML.exe /xslt2 ./mystylesheet.xsl /in myfile /param paramname=paramvalue

and

<xsl:attribute name="paramname" />

or alternatively

AltovaXML.exe /xslt2 ./mystylesheet.xsl /in myfile /param value=paramvalue

and

<xsl:attribute name="value" />

The select attribute can be used to specify an XPath expression that will be executed if the parameter is not overriden from the command line, i.e. a default value.

Link to comment
Share on other sites

That's just it.. you don't refer to parameters in the stylesheet from the program. It's the other way around - the program refers to parameters from the stylesheet.So, you need to either have
AltovaXML.exe /xslt2 ./mystylesheet.xsl /in myfile /param paramname=paramvalue

and

<xsl:attribute name="paramname" />

or alternatively

AltovaXML.exe /xslt2 ./mystylesheet.xsl /in myfile /param value=paramvalue

and

<xsl:attribute name="value" />

The select attribute can be used to specify an XPath expression that will be executed if the parameter is not overriden from the command line, i.e. a default value.

To define a parameter you use
<xsl:param name="paramname"/>

not

<xsl:attribute name="paramname"/>

, that would output an attribute.If you wanted to use the value of a parameter as the value for an attribute you want to create then you would use

<xsl:attribute name="attributename" select="$paramname"/>

in XSLT 2.0.

Link to comment
Share on other sites

To define a parameter you use
<xsl:param name="paramname"/>

not

<xsl:attribute name="paramname"/>

, that would output an attribute.If you wanted to use the value of a parameter as the value for an attribute you want to create then you would use

<xsl:attribute name="attributename" select="$paramname"/>

in XSLT 2.0.

Opps... what an overlook on my part :) . Good catch. :)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...