You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Alessandro Marcellini <am...@tiscalinet.it> on 2000/12/01 17:28:37 UTC

Re: redirect:write select='$var'


Gary L Peskin wrote:

> Alessandro Marcellini wrote:
> >
> > Hi,
> > I'd like to split a big file xml in many file html, one for each branch
> > of my tree.
> > so i've written a xsl like this:
> >    <xsl:template match="DATA">
> >     <!-- get redirect file name from XML input -->
> >       <xsl:variable name="fileid"><xsl:number/></xsl:variable>
> >       <xsl:value-of select="concat('file',$fileid,'.html')"/>
> >       <redirect:write select="concat('file',$fileid,'.html')">
> >                      <xsl:apply-templates/>
> >       </redirect:write>
> >    </xsl:template>
> >
> >    <xsl:template match="fld">
> >       <xsl:value-of select="."/>
> >    </xsl:template>
> > But the select in <redirect:write> element doesn't work!!
> > Someone can help me?
>
> Alessandro --
>
> What doesn't work?  Do you get an error message?  Is output produced?
> Where does it go?  Are you getting a filexxx.html created at all?  What
> version of Xalan are you using?
>
> Details please.
>
> Gary

OK, I'm sorry.
I'm using Xalan java 2.0.D01 on NT and jdk 1.2.2.
The "error" is that: I get no output (no one filexxx.html), I think that the
select in the <redirect:write> tag doesn't work in the same way as
in the <xsl:value-of> tag.
Now I've resolved using a <xsl:variable> to storing the file name and the
attirbute file to passing the name:
<redirect:write file="{$var}">
    ...
</redirect:write>

But my doubt remains: why it isn't correct to use the select attribute?

Thank's
           Alessandro




Re: redirect:write select='$var'

Posted by Gary L Peskin <ga...@firstech.com>.
Alessandro Marcellini wrote:
> I send to you the inputfile (o.xml) and the redirect file (r.xsl)

Alessandro --

I tried the transformation here with the latest version of Xalan built
from CVS and it works just like I'd expect.

Gary

Re: redirect:write select='$var'

Posted by Alessandro Marcellini <am...@tiscalinet.it>.


> Try putting a
>
>  <xsl:message>We got here.</xsl:message>
>
> inside the redirect and see if that ever shows up.  This may provide a
> clue.
>
> Otherwise, please send me the exact, complete copies of both versions of
> the XSL and I'll have a look.
>
> Gary

OK, I've tried, but with the same result.
I send to you the inputfile (o.xml) and the redirect file (r.xsl)

Bye
    Alessandro


Re: redirect:write select='$var'

Posted by Gary L Peskin <ga...@firstech.com>.
Alessandro Marcellini wrote:
> Yes, I'm initiating the trasform from the command line,  there is no error
> message, but I can't find filexxx.html
> in my HD. I get only the part of output that is not redirected on the screen.
> If I use file attribute, instead, I get the files and the non-redirected output.
> Bye
>     Alessandro

Hmm.  This is very strange.  Since you're not getting an error message,
the redirect is probably working but somehow unable to open the files
and silently ignoring that fact.  That is just a guess.

Try putting a 

 <xsl:message>We got here.</xsl:message>

inside the redirect and see if that ever shows up.  This may provide a
clue.

Otherwise, please send me the exact, complete copies of both versions of
the XSL and I'll have a look.

Gary

Re: redirect:write select='$var'

Posted by Alessandro Marcellini <am...@tiscalinet.it>.
>
> This worked just fine for me with the latest release of Xalan J2.  I
> didn't try it with XalanJ 2.0.D01 so I'm not sure if that would work.
> It is correct to use the select attribute like you're using it in the
> example.  The redirect extension itself hasn't changed so I'm not sure
> what's going on.
>
> How are you initiating the transform?  Are you doing it from the command
> line?  I'm thinking that the files are getting written but just not in a
> place that you expect.
>
> Are you getting no output with the select?  Not even an error message?
> If there is no error message, the files are probably getting written
> somewhere.
>
> Gary

Yes, I'm initiating the trasform from the command line,  there is no error
message, but I can't find filexxx.html
in my HD. I get only the part of output that is not redirected on the screen.
If I use file attribute, instead, I get the files and the non-redirected output.
Bye
    Alessandro


Re: redirect:write select='$var'

Posted by Gary L Peskin <ga...@firstech.com>.
Alessandro Marcellini wrote:
> 
> Gary L Peskin wrote:
> 
> > Alessandro Marcellini wrote:
> > >
> > > Hi,
> > > I'd like to split a big file xml in many file html, one for each branch
> > > of my tree.
> > > so i've written a xsl like this:
> > >    <xsl:template match="DATA">
> > >     <!-- get redirect file name from XML input -->
> > >       <xsl:variable name="fileid"><xsl:number/></xsl:variable>
> > >       <xsl:value-of select="concat('file',$fileid,'.html')"/>
> > >       <redirect:write select="concat('file',$fileid,'.html')">
> > >                      <xsl:apply-templates/>
> > >       </redirect:write>
> > >    </xsl:template>
> > >
> > >    <xsl:template match="fld">
> > >       <xsl:value-of select="."/>
> > >    </xsl:template>
> > > But the select in <redirect:write> element doesn't work!!
> > > Someone can help me?
> >
> > Alessandro --
> >
> > What doesn't work?  Do you get an error message?  Is output produced?
> > Where does it go?  Are you getting a filexxx.html created at all?  What
> > version of Xalan are you using?
> >
> > Details please.
> >
> > Gary
> 
> OK, I'm sorry.
> I'm using Xalan java 2.0.D01 on NT and jdk 1.2.2.
> The "error" is that: I get no output (no one filexxx.html), I think that the
> select in the <redirect:write> tag doesn't work in the same way as
> in the <xsl:value-of> tag.
> Now I've resolved using a <xsl:variable> to storing the file name and the
> attirbute file to passing the name:
> <redirect:write file="{$var}">
>     ...
> </redirect:write>
> 
> But my doubt remains: why it isn't correct to use the select attribute?

Alessandro --

This worked just fine for me with the latest release of Xalan J2.  I
didn't try it with XalanJ 2.0.D01 so I'm not sure if that would work. 
It is correct to use the select attribute like you're using it in the
example.  The redirect extension itself hasn't changed so I'm not sure
what's going on.

How are you initiating the transform?  Are you doing it from the command
line?  I'm thinking that the files are getting written but just not in a
place that you expect.

Are you getting no output with the select?  Not even an error message? 
If there is no error message, the files are probably getting written
somewhere.

Gary