I'm having problems with xalan redirect extension. I have an xml file
from which I am extracting info to create a set of cue files to use in
audio editing. I need the output to be plain text, so use the following:
<xsl:output method="text" omit-xml-declaration="yes"/>
The xslt works fine if I use it to produce individual files. However, if
I use redirect:write to produce multiple files:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//person">
<redirect:write
select="concat(translate(substring-after(anumber, '200'), '.', '_'),
'._q')">
<!-- code to produce output -->
</redirect:write>
</xsl:template>
</xsl:stylesheet>
I get an XML declaration at the head of my output files. I've had a
quick read through xalan docs and cn't find anything to help. Has anyone
out there any advice that might help me solve this issue?
I have included the full xslt below.
Best wishes
Mike Hirst
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//person">
<redirect:write
select="concat(translate(substring-after(anumber, '200'), '.', '_'),
'.cue')">
<xsl:value-of select="concat('FILE "g:\',
translate(substring-after(anumber, '200'), '.', '_'), '.wav" WAVE')"/>
<xsl:value-of select="'
'"/>
<xsl:for-each select="clip">
<xsl:value-of select="concat('TRACK ',
format-number(qnumber, '00'), ' AUDIO')"/>
<xsl:value-of select="'
'"/>
<xsl:value-of select="concat('TITLE ', '"',
../name, ' - ', format-number(qnumber, '00'), '"')"/>
<xsl:value-of select="'
'"/>
<xsl:if test="substring(start,2,1) = 1">
<xsl:value-of select="concat('INDEX 01 ',
substring(start,4,2) + 60,':',substring(start,7),':00')"/>
</xsl:if>
<xsl:if test="substring(start,2,1) = 0">
<xsl:value-of select="concat('INDEX 01 ',
substring(start,4),':00')"/>
</xsl:if>
<xsl:value-of select="'
'"/>
<xsl:if test="substring(end,2,1) = 1">
<xsl:value-of select="concat('INDEX 01 ',
substring(end,4,2) + 60,':',substring(end,7),':00')"/>
</xsl:if>
<xsl:if test="substring(end,2,1) = 0">
<xsl:value-of select="concat('INDEX 01 ',
substring(end,4),':00')"/>
</xsl:if>
<xsl:value-of select="'
'"/>
</xsl:for-each>
</redirect:write>
</xsl:template>
</xsl:stylesheet>
--
Mike Hirst
Mike Hirst - Digital Audio
http://www.mikehirst-digitalaudio.com
tel: 0191 289 3186
mailto:mike.hirst@xxxxxxxxxxxxxxxx