Subject: RE: Re: [xsl] how to split one xml to multiple xml files From: "Josh Canfield" <Josh.Canfield@xxxxxxxxxxxx> Date: Fri, 30 Apr 2004 14:03:03 -0700 |
xsl:document is an XSLT 1.1 element for outputting to different files. In saxon you can use it simply by changing your stylesheet version to 1.1. An example from the Saxon documentation: <xsl:template match="preface"> <xsl:document href="{$dir}\preface.html"> <html><body bgcolor="#00eeee"><center> <xsl:apply-templates/> </center><hr/></body></html> </xsl:document> <a href="{$dir}\preface.html">Preface</a> </xsl:template> -----Original Message----- From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx] Sent: Friday, April 30, 2004 1:39 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: Re: [xsl] how to split one xml to multiple xml files 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. -- Charles Knell cknell@xxxxxxxxxx - email -----Original Message----- From: Qin Ding <qding@xxxxxxx> Sent: Fri, 30 Apr 2004 16:17:23 -0400 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] how to split one xml to multiple xml files I tried to split a big xml file into multiple xml files based on the <pg-nbr>. If I have this: <chapter> <section id="sc1"> <subsection id="sb1"> <pg-nbr id="p1"></pg-nbr> <pg-nbr id="p2"></pg-nbr> <pg-nbr id="p3"></pg-nbr> <pg-nbr id="p4"></pg-nbr> </subsection> <subsection id="sb2"> <pg-nbr id="p5"></pg-nbr> <pg-nbr id="p6"></pg-nbr> <pg-nbr id="p7"></pg-nbr> </subsection> </section> <section id="sc2"> <subsection id="sb3"> <pg-nbr id="p8"></pg-nbr> </subsection> <subsection id="sb4"> <pg-nbr id="p9"></pg-nbr> <pg-nbr id="p10"></pg-nbr> </subsection> </section> </chapter> I want to split above files to this file: sc1sb1p1.xml <chapter> <section id="sc1"> <subsection id="sb1"> <pg-nbr id="p1><pg-nbr> </subsection> </section> </chapter> sc1sb1p2.xml <chapter> <section id="sc1"> <subsection id="sb1"> <pg-nbr id="p2><pg-nbr> </subsection> </section> </chapter> sc1sb1p3.xml <chapter> <section id="sc1"> <subsection id="sb1"> <pg-nbr id="p3><pg-nbr> </subsection> </section> </chapter> etc and etc. How do I write xsl logic? How do I automatically generate the output file name? How do I go through the loop to create many, many smaller xml files? In above example, I should have 10 xml files created. Someone suggests that I use xsl:document href="" to output the xml files. I tried to use that but I can't even compile my xsl file. Can someone show me how to do this, please? Thank you very much. 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. ----------------------------------------------------------------------------------------
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Re: [xsl] how to split one xml , Michael Kay | Thread | [xsl] [ANN] RenderX XEP for .NET is, Nikolai Grigoriev |
[xsl] [ANN] RenderX XEP for .NET is, Nikolai Grigoriev | Date | RE: Re: [xsl] how to split one xml , Michael Kay |
Month |