RE: [xsl] splitting one xml into many xml documents using xsl

Subject: RE: [xsl] splitting one xml into many xml documents using xsl
From: "Sebastian Rahtz" <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 9 Mar 2001 22:40:25 +0000
Michael Kay writes:
 > Many XSLT processors have the ability to do it but (until XSLT 1.1) the
 > details are vendor-specific. Use xsl:document with Saxon, xalan:write with
 > Xalan, etc.

my current solution is appended. a template "outputChunk" to which you
pass the desired filename, and the material to write to it. note the
use of version="1.1", to get the xsl:document through (this fires with
Saxon 6.2.1 and jdxslt).

I'd be interested in other xsl:when statements for this. among
the problems:

   - unless its changed, Oracle processor can't work this way, it wants
     some top-level declaration
   - Xalan J and Xalan C return the same "vendor" - does anyone know how
     to distinguish them
   - XT does not implement forward-compatible processing properly
   - not does Sablotron (and it has no extensions anyway)
   - what are the right incantations for 4xslt? I would install it and try,
     but Python applications never work for me, cos they dont like the colour
     of my socks
   - do any other processors support the functionality? Unicorn?

sebastian

<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    extension-element-prefixes="saxon"
    xmlns:saxon="http://icl.com/saxon";
    exclude-result-prefixes="saxon" 
    version="1.1">

<xsl:template name="outputChunk">
 <xsl:param name="ident"/>
 <xsl:param name="content"/>
  <xsl:choose>
  <xsl:when test="element-available('xsl:document')">
      <xsl:document encoding="{$outputEncoding}" 
               method="html" href="{$ident}">
        <xsl:copy-of select="$content"/>
      </xsl:document> 
    </xsl:when>
  <xsl:when test="contains($processor,'SAXON')">
      <saxon:output encoding="{$outputEncoding}" 
               method="html" file="{$ident}">
        <xsl:copy-of select="$content"/>
      </saxon:output> 
  </xsl:when>
  <xsl:when test="contains($processor,'Apache')">
      <xalan:write 
        xsl:extension-element-prefixes="xalan"
        xmlns:xalan="org.apache.xalan.xslt.extensions.Redirect"
        file="{$ident}">
        <xsl:copy-of select="$content"/>
      </xalan:write>
  </xsl:when>
  <xsl:otherwise>
    <xsl:copy-of select="$content"/>
  </xsl:otherwise>
  </xsl:choose>
</xsl:if>

</xsl:template>

</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread