[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: import href vaule set using Xpath

Subject: Re: import href vaule set using Xpath
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 25 Feb 2002 15:55:54 +0000
xsl import href
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.