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 12:46:42 -0400
Michael:

My goal is to use the xsl to split a large xml into multple smaller xml
files and save them on the disk.  I intend to use Ant task to execute it.
So, the file name and directory  where the splitted file should be saved in
will be determined at run-time.  That's why I tried to define variables for
both directory and file name in my xsl.

How can I achieve this goal?  I read about saxon extension saxon:output and
xsl:result-document.  Which one is good for me for my task?  How can I
instruct the xsl processor what the directory the output file should be
saved at using href attributes? and without using -o .

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 
                      05/03/04 11:06           files                                                       
                      AM                                                                                   
                      Please respond                                                                       
                      to xsl-list                                                                          
                                                                                                           
                                                                                                           




>
> 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?

It means you haven't specified the -o option on the command line, or the
equivalent in the API. This is needed for resolving a relative URI in the
href attribute.

 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.
>

The value of the select attribute of xsl:variable is an XPath expression.
You probably meant to write
<xsl:variable name="dir" select="'d:\results'" />

but that wouldn't do you much good either, because the href value must be a
URI, not a filename.

Michael Kay

Current Thread