Subject: Re: [xsl] import href vaule set using Xpath From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 25 Feb 2002 15:55:54 +0000 |
Hi Aedemar, >> can the value of the href attributes of the xsl:import command be set >> using XPath notation? >> >> I would like to retrieve the value of the stylesheet to import from >> the Xml document. >> >> I tried <xsl:import href="{//stylesheetname}"/> and got the error that >> it couldn't find {//stylesheetname}. As Ken has said, you can't do this within a single stylesheet. However, you can turn the process into a two-stage process where the first stage generates the stylesheet you need for the second stage: generator -> stylesheet ^ | | v XML document -> process -> result The "generator" in the above diagram can be anything from a piece of code that manipulates the stylesheet that you have as a DOM, to create the stylesheet that you want, to a full XSLT stylesheet that generates the stylesheet that you're after. Another design that you might consider is to embed the xsl:import within the XML document itself, using an embedded stylesheet as follows: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="#style"?> <!DOCTYPE doc [ <!ATTLIST xsl:stylesheet id ID #REQUIRED> ]> <doc> ... <xsl:stylesheet id="style" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="doc-specific-stylesheet.xsl" /> <xsl:import href="general-stylesheet.xsl" /> <xsl:template match="xsl:stylesheet" /> </xsl:stylesheet> ... </doc> This pattern doesn't work with all processors (specifically, it doesn't work with MSXML). Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] import href vaule set using X, Aedemar Cooke | Thread | Re: [xsl] import href vaule set usi, G. Ken Holman |
Re: Re: [xsl] creating sequence dia, Roland Lechner | Date | [xsl] binding an xpath expression t, 林 子芯 |
Month |