Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 29th, 2006, 02:55 AM
Authorized User
 
Join Date: May 2006
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Constants in XSL

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

 
Old August 29th, 2006, 03:17 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
 
Old August 29th, 2006, 06:04 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass link values as xsl:parameter to php5 then xsl pauljr8 XSLT 1 July 2nd, 2007 10:32 PM
declaring constants and pointer constants proslambano BOOK: Ivor Horton's Beginning Visual C++ 2005 3 March 6th, 2007 03:32 PM
Global/Public Constants elansolutionsltd Access 6 May 13th, 2005 12:22 PM
DriveType constants fordrs3 Beginning VB 6 1 June 22nd, 2003 08:23 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.