Project

Profile

Help

Resolving URI from variable in href attribut

Added by Anonymous over 18 years ago

Legacy ID: #3399595 Legacy Poster: sh (sh_9109394)

Hello, I'm writing a XSLFO script for generating a PDF file from a XML source, produced by a database. I devided the XSLFO script in some parts. In the starting script I merge the parts with 'xsl:include'. Up to now I use hard coded names. But to meet the language specific numberformates I want to write a short xsl file with the specific numberformat from the database. The name and path of the xsl file I write in a configuration file. With a XSLT function I read this name and path in a XSL variable. But the 'xsl:include' function doesn't resolve the string from the variable. working example: <xsl:include href="c:/include.xsl" /> not working. <xsl:variable name="includefile" select="'c:/include.xsl'" /> <xsl:include href="{$includefile}" /> I get this error message: Saxon 8.5.1 from Saxonica Java version 1.5.0_03 Error at xsl:include on line 623 of file:/c:/starting.xsl: XTSE0165: net.sf.saxon.trans.DynamicError: Invalid relative URI {{$includefile}} : Illegal character in path at index 0: {$includefile} Failed to compile stylesheet. 1 error detected. thanks Stefan


Replies (1)

RE: Resolving URI from variable in href attri - Added by Anonymous over 18 years ago

Legacy ID: #3400365 Legacy Poster: Michael Kay (mhkay)

You can't modify a stylesheet at run-time, which is what you are trying to do. The href attribute of xsl:include must be a URI, not an expression. The usual answer to this requirement is to turn things upside-down. You should include or import general-purpose code into a stylesheet that handles the special case, not the other way around, and then run the transformation by nominating the special-purpose stylesheet as your entry point. Also: please raise general XSLT coding issues on the xsl-list at mulberrytech.com - this list is for things specific to the Saxon product. Michael Kay http://www.saxonica.com/

    (1-1/1)

    Please register to reply