[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: redirect

Subject: Re: redirect
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 4 Mar 2007 23:58:39 +0530
Re:  redirect
I think, you would get prompt answers for Xalan-J related questions on
xalan-j-users@xxxxxxxxxxxxxxx

You could consider moving to XSLT 2.0. It has an instruction
xsl:result-document for this requirement.

On 3/4/07, Mike Hirst <mike.hirst@xxxxxxxxxxxxxxxx> wrote:
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


--
Regards,
Mukul Gandhi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.