xsl result-doc does not write results to file...

Here should go questions about transforming XML with XSLT and FOP.
wilkinsr
Posts: 6
Joined: Sun Apr 30, 2006 7:37 pm

xsl result-doc does not write results to file...

Post by wilkinsr »

I'm trying to use xsl result-document to output to multiple files. I'm running this stylesheet:

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

<xsl:output method="text"/>
<xsl:output method="html" indent="yes" name="html"/>

<xsl:template match="/">
<xsl:for-each select="//testrun">
<xsl:variable name="filename"
select="concat('c:/',@run,'.html')" />
<xsl:value-of select="$filename" /> <!-- Creating -->
<xsl:result-document href="{$filename}" format="html">
<html><body>
<xsl:value-of select="@run"/>
</body></html>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Against this xml:

<?xml version="1.0" encoding="UTF-8"?>
<tests>
<testrun run="test1">
<test name="foo" pass="true" />
<test name="bar" pass="true" />
<test name="baz" pass="true" />
</testrun>
<testrun run="test2">
<test name="foo" pass="true" />
<test name="bar" pass="false" />
<test name="baz" pass="false" />
</testrun>
<testrun run="test3">
<test name="foo" pass="false" />
<test name="bar" pass="true" />
<test name="baz" pass="false" />
</testrun>
</tests>

I'm working in Eclipse 3.1.2, running jdk 1.5, and using Saxon 8B as the transformer. Saxon seems to be processing correctly, but I don't get any physical files. The output tab lists the correct path and file name, but no files. Any suggestions?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: xsl result-doc does not write results to file...

Post by sorin_ristache »

Hello,
wilkinsr wrote:<xsl:variable name="filename" select="concat('c:/',@run,'.html')" />

...

<xsl:result-document href="{$filename}" format="html">
Specify a valid URL for variable filename that is used to create an output file:

Code: Select all

<xsl:variable name="filename" select="concat('file:/c:/',@run,'.html')"/>

Regards,
Sorin
Post Reply