RE: [xsl] How to select a document element from the input xml file using xslt?

Subject: RE: [xsl] How to select a document element from the input xml file using xslt?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 13 Jul 2004 10:00:27 +0100
> I had this same problem just today and solved it exactly the way you
> described.  You mention that more control over this will be 
> possible in
> XLST 2.0.  I'm currently using Saxon 8.0.  Was there a more elegant
> method I could have used to solve this problem?
> 

XSLT 2.0 (and Saxon 8.0) currently allow you to have named xsl:output
declarations, so you can do:

<xsl:output name="p1" doctype-system="pppp1"/>
<xsl:output name="p2" doctype-system="pppp2"/>

<xsl:template match="/">
  <xsl:choose>
    <xsl:when test="...">
      <xsl:result-document format="p1">
        ...
      </
    </
    <xsl:otherwise>
      <xsl:result-document format="p2">
        ...
      </
    </
  </
</

In the next draft, as a result of public comments, you will be allowed to
select serialization attributes individually using AVTs in the
xsl:result-document instruction, i.e.

   <xsl:result-document doctype-system="{$p1}">

Michael Kay

Current Thread