<xsl:result-document> is better if what you are trying to achieve is more than
one output per transformation. It's better because <xsl:document> is used to
create an intermediate document upon which you intend to do further processing
in the same transformation. Of course, if you don't intend to output multiple
documents from a single transformation, it's hard to see why you would use it
at all.
In any case, neither is available in XSLT 1.0. That's important because your
stylesheet is declared as a 1.0 stylesheet.
It's not clear what this has to do with the sample input and stylesheet you
provided. If you explain your problem a little further, someone will be able to
help.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Asbjørn Reglund Thorsen
<a(_dot_)r(_dot_)thorsen(_at_)usit(_dot_)uio(_dot_)no>
Sent: Mon, 10 Apr 2006 13:31:57 +0200
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Generating barcode SVG-files
I have used RenderX's 2to5 interleave barcode generator.
My question is: How can I generate 222222.svg, 123456.svg and
019283.svg files (see my test-XML below) ? I probably need to make a
recurcive template ?
I was told that I should use xsl:document. Is xsl:result-document better
in any way ?
My test-XML:
---------------------------------
<?xml version="1.0"?>
<doc>
<barcodes>
<barcode value="222222" addchecksum="false"/>
<barcode value="123456" addchecksum="false"/>
<barcode value="019283" addchecksum="false"/>
</barcodes>
</doc>
My test-XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import href="2of5i.xsl"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<fo:root font-family="Times" font-size="10pt">
<fo:layout-master-set>
<fo:simple-page-master master-name="barcodes-page">
<fo:region-body margin="0.5in" border="0.25pt solid silver"
padding="10pt"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="barcodes-page">
<fo:flow flow-name="xsl-region-body">
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="barcodes">
<xsl:for-each select="barcode">
<xsl:apply-templates select="." mode="draw"/>
</xsl:for-each>
</xsl:template>
<!-- This template call barcode generator to create SVG
representation of 2-of-5 interleave barcode -->
<xsl:result-document href="mytestfile.svg"> <!-- this doesn't work
but illustrates how lost I am -->
<xsl:template match="barcode" mode="draw">
<fo:block>
<fo:instream-foreign-object content-width="20mm"
content-height="20mm">
<xsl:call-template name="barcode-2of5i">
<xsl:with-param name="value" select="@value"/>
<xsl:with-param name="addchecksum" select="@addchecksum"/>
</xsl:call-template>
</fo:instream-foreign-object>
</fo:block>
</xsl:template>
</xsl:result-document>
</xsl:stylesheet>
--
Asbjørn Thorsen
"HAKONA MATATA" ;-)
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--