Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] redirect

From: Mike Hirst <mike.hirst@---------------->
To:
Date: 3/4/2007 3:30:00 PM
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 &quot;g:\', 
translate(substring-after(anumber, '200'), '.', '_'), '.wav&quot; WAVE')"/>

           <xsl:value-of select="'&#xA;'"/>

           <xsl:for-each select="clip">

               <xsl:value-of select="concat('TRACK ', 
format-number(qnumber, '00'), ' AUDIO')"/>

               <xsl:value-of select="'&#xA;'"/>

               <xsl:value-of select="concat('TITLE ', '&quot;', 
../name, ' - ', format-number(qnumber, '00'), '&quot;')"/>

               <xsl:value-of select="'&#xA;'"/>

               <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="'&#xA;'"/>

               <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="'&#xA;'"/>

           </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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent