Subject: Constants in XSL
Posted By: austinf Post Date: 8/29/2006 2:55:02 AM
hi i am using a formatting option in many XSLT files and i want to know wheter i can create a constant in another file and use it.

Thanks

Reply By: joefawcett Reply Date: 8/29/2006 3:17:40 AM
You can use xsl:include other XSLT files. If you want you can have XML content in the include, you just need it in a different namespace to the XSL itself. You can then access the XML via the document('') function.
If that's not what you meant try to show an example of what you need.

--

Joe (Microsoft MVP - XML)
Reply By: mhkay Reply Date: 8/29/2006 6:04:30 AM
You have two options. You can do an xsl:include on a stylesheet module containing

<xsl:stylesheet...>

<xsl:variable name="X" select="value"/>

</xsl:stylesheet>

That's good if the "constant" is known at compile time. If you want a run-time parameter, it would be better to put it in an XML document and read it using the document() function.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Go to topic 48988

Return to index page 191
Return to index page 190
Return to index page 189
Return to index page 188
Return to index page 187
Return to index page 186
Return to index page 185
Return to index page 184
Return to index page 183
Return to index page 182