RE: [xsl] Split files with XSLT2.0 xsl:result-document

Subject: RE: [xsl] Split files with XSLT2.0 xsl:result-document
From: "Robert Soesemann" <rsoesemann@xxxxxxxxxxx>
Date: Mon, 6 Dec 2004 16:12:13 +0100
I need to call it from an Ant script:
E.g.:
    	      <xslt basedir="${kiwi_dir}"
    		  destdir="${split_dir}"
        	  classpath="${lib_dir}/saxon8.jar"
              processor="trax"
    		  style="${xsl_dir}\split-document.xsl"
    		  includes="**/*.xml">
  		</xslt>

Could you please tell me what to put in the ??? And if I am doing this
right?

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

	<xsl:template match="kiwi-contentitem">
		<xsl:result-document href="???">
			<xsl:copy>
				<xsl:copy-of select="@*"/>
			</xsl:copy>
		</xsl:result-document>
	</xsl:template>

</xsl:stylesheet>

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Montag, 6. Dezember 2004 16:02
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Split files with XSLT2.0 xsl:result-document



You haven't said how you are calling the transform.
You want the output directory structure to mimic the input structure.
You could either do that by specifying the output directory at the same
time as the input directory, or by accessing the base-uri of the input
and then using replace to replace the input directory name by the output
directory.  Which is easier/most preferable depends rather on how you
are supplying the input file name.


the last part of your output path, a number or the anchor is just
something like

 href="{$outputdir}/{if (anchor) then anchor/@name else
position()}.xml">

assuming that your current sequence is the sequence of contentitem
elements, and that you want to number the named ones, even if the number
is not shown, so 1,2,xyz,4 rather than 1,2,xyz,3

Did you really mean bar#xyz.xml (I'm assuming you didn't in the above)
having a # in the filename would be odd, and complicate the mapping
between file names and URI's.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. For more information on a proactive anti-virus
service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread