mfran2002 Posted February 7, 2010 Share Posted February 7, 2010 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 More sharing options...
boen_robot Posted February 7, 2010 Share Posted February 7, 2010 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 More sharing options...
Martin Honnen Posted February 7, 2010 Share Posted February 7, 2010 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 haveAltovaXML.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 More sharing options...
mfran2002 Posted February 7, 2010 Author Share Posted February 7, 2010 thanks a lot to all of you guys Link to comment Share on other sites More sharing options...
boen_robot Posted February 7, 2010 Share Posted February 7, 2010 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.