RE: Re: [xsl] how to split one xml to multiple xml files

Subject: RE: Re: [xsl] how to split one xml to multiple xml files
From: Qin Ding <qding@xxxxxxx>
Date: Mon, 3 May 2004 11:49:34 -0400
Michael and others:

Thank you all for your advice.  I downloaded latest saxon and modified my
xsl file like the following:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0">
  <xsl:output method="xml"
              encoding="ISO-8859-1"
              doctype-public="-//AIKON//DTD EPC DOCUMENT Ver:5.1.1//EN"
              indent="yes"/>
  <xsl:variable name="file_name"
select="concat('cat',string(/epc/@vol-nbr),'_toc')" />

    <!-- List the attribute names and values. -->
 <xsl:template match="epc">
    <xsl:result-document href="{$file_name}">
      <xsl:copy>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates select="toc"/>
        <xsl:apply-templates select="chapter"/>
      </xsl:copy>
  </xsl:result-document>
</xsl:template>

Rerun the xsl using saxon7.jar.  I got this error:
D:\projects\epubs_xslt\src\gmemd\xml\cat\cat701>java -jar
..\..\..\..\..\lib\sax
on7.jar cat701.xml ..\..\..\xsl\createCatToc.xsl
Error at result-document on line 11 of
file:/D:/projects/epubs_xslt/src/gmemd/xm
l/cat/cat701/../../../xsl/createCatToc.xsl:
  The system identifier of the principal output file is unknown
Transformation failed: Run-time errors were reported

What does it mean?  I tried to create another variable to specify the
directory like this:
<xsl:variable name="dir" select="d:\results" />
But I got the error stating   "XPath syntax error in {D:/results}:
    QName cannot end with colon: {D:}
Transformation failed: Failed to compile stylesheet. 1 error detected.

Please advise.  Thank you!

Qin
----------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------




                                                                                                           
                      "Michael Kay"                                                                        
                      <mhk                     To:      <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                  
                      @mhk.me.uk>              cc:                                                         
                                               Subject: RE: Re: [xsl] how to split one xml to multiple xml 
                      04/30/04 04:20           files                                                       
                      PM                                                                                   
                      Please respond                                                                       
                      to xsl-list                                                                          
                                                                                                           
                                                                                                           




> XSL 1.0 doesn't have a way to do this, though many processors
> have extensions that will do this for you. How and if you do
> it depends on your processor. Consult the processor's
> documentation.  "Someone" who suggested using the document()
> function doesn't understand that its purpose is to read
> external XML files rather than to write them.

No, I think "someone" had come across the xsl:document instruction in the
now-defunct XSLT 1.1 working draft, which in XSLT 2.0 has been renamed
xsl:result-document.

Michael Kay

Current Thread