You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marcel Jurk <ma...@yahoo.de> on 2002/12/12 21:45:20 UTC
xsl:copy-of Problem
Hi,
since I use Cocoon2.1 (CVS 12.12.2002) I have the
following problem.
When I use <xsl:copy-of select="."/> in a
xsl-stylesheet, only the values form the elements are
copied, but not the element itself, e.g. when I
transform the following xml data:
<all>
<message>
<text>msg1<text>
</message>
<message>
<text>msg2<text>
</message>
</all>
with the stylesheet:
<xsl:template match="/">
<xsl:variable name="m">
<xsl:call-template name="sortmsg"/>
</xsl:variable>
</xsl:template>
<xsl:template name="sortmsg">
<xsl:for-each select="/all/message">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
then are only "msg1 msg2" is copied and not
"<message>
<text>msg1</text>
</message>
<message>
<text>msg2</text>
</message>"
I use the following transformer:
<map:transformer logger="sitemap.transformer.xsltc"
name="xslt" pool-grow="2" pool-max="32" pool-min="8"
src="org.apache.cocoon.transformation.TraxTransformer">
<use-request-parameters>false</use-request-parameters>
<use-browser-capabilities-db>false</use-browser-capabilities-db>
<transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</transformer-factory>
</map:transformer>
Does anyone know an answer.
Thanks in advance,
Marcel
__________________________________________________________________
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: xsl:copy-of Problem
Posted by Marcel Jurk <ma...@yahoo.de>.
Hi Joerg,
with that code I got the values from 5 elements and
these elements are sorted according to all elements.
Marcel
> Doesn't this sort only the first 5 elements?
>
> <xsl:for-each select="/all/message">
> <xsl:sort select="."/>
> <xsl:if test="position() < 6">
> <xsl:value-of select="."/>
> </xsl:if>
> </xsl:for-each>
>
> Joerg
>
> Conal Tuohy wrote:
> > How about something like this, then?
> >
> > <xsl:variable name="m" select="/all/message"/>
> >
> > <xsl:for-each select="$m[position()<6">
> > <xsl:sort select="."/>
> > <!-- sample output here -->
> > <xsl:value-of select="."/>
> > </xsl:for-each>
> >
> > Or you might want to look at:
> >
>
http://www.dpawson.co.uk/xsl/sect2/N6461.html#d6361e489
> >
> > Really you should ask this kind of question on the
> mulberrytech xsl list;
> > you'll get more response! :-)
> >
> > Con
> >
> >>-----Original Message-----
> >>From: Marcel Jurk [mailto:marceljurk@yahoo.de]
> >>Sent: Sunday, 15 December 2002 18:52
> >>To: cocoon-users@xml.apache.org
> >>Subject: RE: RE: xsl:copy-of Problem
> >>
> >>
> >>Hi Con,
> >>
> >>thanks for the hint with the RTF. But my problem
> is,
> >>that I want first sort the elements and afterwards
> I
> >>want output only the first five elements.
> >>With your example
> >><xsl:variable name="m" select="/all/message"/>
> >>is no sorting possible.
> >>
> >>Regards,
> >>Marcel
>
>
>
---------------------------------------------------------------------
> Please check that your question has not already
> been answered in the
> FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:
> <co...@xml.apache.org>
> For additional commands, e-mail:
> <co...@xml.apache.org>
>
__________________________________________________________________
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: xsl:copy-of Problem
Posted by Joerg Heinicke <jo...@gmx.de>.
Doesn't this sort only the first 5 elements?
<xsl:for-each select="/all/message">
<xsl:sort select="."/>
<xsl:if test="position() < 6">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
Joerg
Conal Tuohy wrote:
> How about something like this, then?
>
> <xsl:variable name="m" select="/all/message"/>
>
> <xsl:for-each select="$m[position()<6">
> <xsl:sort select="."/>
> <!-- sample output here -->
> <xsl:value-of select="."/>
> </xsl:for-each>
>
> Or you might want to look at:
> http://www.dpawson.co.uk/xsl/sect2/N6461.html#d6361e489
>
> Really you should ask this kind of question on the mulberrytech xsl list;
> you'll get more response! :-)
>
> Con
>
>>-----Original Message-----
>>From: Marcel Jurk [mailto:marceljurk@yahoo.de]
>>Sent: Sunday, 15 December 2002 18:52
>>To: cocoon-users@xml.apache.org
>>Subject: RE: RE: xsl:copy-of Problem
>>
>>
>>Hi Con,
>>
>>thanks for the hint with the RTF. But my problem is,
>>that I want first sort the elements and afterwards I
>>want output only the first five elements.
>>With your example
>><xsl:variable name="m" select="/all/message"/>
>>is no sorting possible.
>>
>>Regards,
>>Marcel
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: RE: xsl:copy-of Problem
Posted by Conal Tuohy <co...@paradise.net.nz>.
How about something like this, then?
<xsl:variable name="m" select="/all/message"/>
<xsl:for-each select="$m[position()<6">
<xsl:sort select="."/>
<!-- sample output here -->
<xsl:value-of select="."/>
</xsl:for-each>
Or you might want to look at:
http://www.dpawson.co.uk/xsl/sect2/N6461.html#d6361e489
Really you should ask this kind of question on the mulberrytech xsl list;
you'll get more response! :-)
Con
> -----Original Message-----
> From: Marcel Jurk [mailto:marceljurk@yahoo.de]
> Sent: Sunday, 15 December 2002 18:52
> To: cocoon-users@xml.apache.org
> Subject: RE: RE: xsl:copy-of Problem
>
>
> Hi Con,
>
> thanks for the hint with the RTF. But my problem is,
> that I want first sort the elements and afterwards I
> want output only the first five elements.
> With your example
> <xsl:variable name="m" select="/all/message"/>
> is no sorting possible.
>
> Regards,
> Marcel
>
> Marcel your variable $m holds a Result Tree
> > Fragment, not a NodeSet. A RTF
> > is not as useful as a nodeset. In particular you
> > can't use "for-each" with
> > it.
> >
> > See
> >
> http://www.w3.org/TR/xslt#section-Result-Tree-Fragments
> >
> >
> > Try assigning the variable like this:
> > <xsl:variable name="m" select="/all/message"/>
> >
> > Cheers!
> >
> > Con
> >
> > > -----Original Message-----
> > > From: Marcel Jurk [mailto:marceljurk@yahoo.de]
> > > Sent: Saturday, 14 December 2002 07:16
> > > To: cocoon-users@xml.apache.org
> > > Subject: RE: RE: xsl:copy-of Problem
> > >
> > >
> > > Sorry I forgott the following lines in the
> > stylesheet.
> > >
> > > <xsl:template match="/">
> > > <xsl:variable name="m">
> > > <xsl:call-template name="sortmsg"/>
> > > </xsl:variable>
> > > <xsl:for-each select="$m">
> > > <xsl:value-of select="name(.)/> <!-- No output
> > -->
> > > <xsl:value-of select="."/> <!-- Output:
> > msg1msg2
> > > -->
> > > </xsl:for-each>
> > > </xsl:template>
> > >
> > > <xsl:template name="sortmsg">
> > > <xsl:for-each select="/all/message">
> > > <xsl:copy-of select="."/>
> > > </xsl:for-each>
> > > </xsl:template>
> > >
> > > In the <xsl:for-each> loop must be the output two
> > > times message, but I got no output and the loop is
> > > pass only once.
> > > I think that not the tree is copied with the
> > > <xsl:copy-of> in the template sortmsg, but only
> > the
> > > values.
> > >
> > > Before the currently c2.1 (cvs 12.12) version, I
> > used
> > > c2.1 (cvs 30.10) and with it works fine, but now
> > not.
> > >
> > > Marcel
> >
> >
> >
> ---------------------------------------------------------------------
> > Please check that your question has not already
> > been answered in the
> > FAQ before posting.
> > <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail:
> > <co...@xml.apache.org>
> > For additional commands, e-mail:
> > <co...@xml.apache.org>
> >
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: RE: xsl:copy-of Problem
Posted by Marcel Jurk <ma...@yahoo.de>.
Hi Con,
thanks for the hint with the RTF. But my problem is,
that I want first sort the elements and afterwards I
want output only the first five elements.
With your example
<xsl:variable name="m" select="/all/message"/>
is no sorting possible.
Regards,
Marcel
Marcel your variable $m holds a Result Tree
> Fragment, not a NodeSet. A RTF
> is not as useful as a nodeset. In particular you
> can't use "for-each" with
> it.
>
> See
>
http://www.w3.org/TR/xslt#section-Result-Tree-Fragments
>
>
> Try assigning the variable like this:
> <xsl:variable name="m" select="/all/message"/>
>
> Cheers!
>
> Con
>
> > -----Original Message-----
> > From: Marcel Jurk [mailto:marceljurk@yahoo.de]
> > Sent: Saturday, 14 December 2002 07:16
> > To: cocoon-users@xml.apache.org
> > Subject: RE: RE: xsl:copy-of Problem
> >
> >
> > Sorry I forgott the following lines in the
> stylesheet.
> >
> > <xsl:template match="/">
> > <xsl:variable name="m">
> > <xsl:call-template name="sortmsg"/>
> > </xsl:variable>
> > <xsl:for-each select="$m">
> > <xsl:value-of select="name(.)/> <!-- No output
> -->
> > <xsl:value-of select="."/> <!-- Output:
> msg1msg2
> > -->
> > </xsl:for-each>
> > </xsl:template>
> >
> > <xsl:template name="sortmsg">
> > <xsl:for-each select="/all/message">
> > <xsl:copy-of select="."/>
> > </xsl:for-each>
> > </xsl:template>
> >
> > In the <xsl:for-each> loop must be the output two
> > times message, but I got no output and the loop is
> > pass only once.
> > I think that not the tree is copied with the
> > <xsl:copy-of> in the template sortmsg, but only
> the
> > values.
> >
> > Before the currently c2.1 (cvs 12.12) version, I
> used
> > c2.1 (cvs 30.10) and with it works fine, but now
> not.
> >
> > Marcel
>
>
>
---------------------------------------------------------------------
> Please check that your question has not already
> been answered in the
> FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:
> <co...@xml.apache.org>
> For additional commands, e-mail:
> <co...@xml.apache.org>
>
__________________________________________________________________
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: RE: xsl:copy-of Problem
Posted by Conal Tuohy <co...@paradise.net.nz>.
Marcel your variable $m holds a Result Tree Fragment, not a NodeSet. A RTF
is not as useful as a nodeset. In particular you can't use "for-each" with
it.
See http://www.w3.org/TR/xslt#section-Result-Tree-Fragments
Try assigning the variable like this:
<xsl:variable name="m" select="/all/message"/>
Cheers!
Con
> -----Original Message-----
> From: Marcel Jurk [mailto:marceljurk@yahoo.de]
> Sent: Saturday, 14 December 2002 07:16
> To: cocoon-users@xml.apache.org
> Subject: RE: RE: xsl:copy-of Problem
>
>
> Sorry I forgott the following lines in the stylesheet.
>
> <xsl:template match="/">
> <xsl:variable name="m">
> <xsl:call-template name="sortmsg"/>
> </xsl:variable>
> <xsl:for-each select="$m">
> <xsl:value-of select="name(.)/> <!-- No output -->
> <xsl:value-of select="."/> <!-- Output: msg1msg2
> -->
> </xsl:for-each>
> </xsl:template>
>
> <xsl:template name="sortmsg">
> <xsl:for-each select="/all/message">
> <xsl:copy-of select="."/>
> </xsl:for-each>
> </xsl:template>
>
> In the <xsl:for-each> loop must be the output two
> times message, but I got no output and the loop is
> pass only once.
> I think that not the tree is copied with the
> <xsl:copy-of> in the template sortmsg, but only the
> values.
>
> Before the currently c2.1 (cvs 12.12) version, I used
> c2.1 (cvs 30.10) and with it works fine, but now not.
>
> Marcel
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: RE: xsl:copy-of Problem
Posted by Marcel Jurk <ma...@yahoo.de>.
Sorry I forgott the following lines in the stylesheet.
<xsl:template match="/">
<xsl:variable name="m">
<xsl:call-template name="sortmsg"/>
</xsl:variable>
<xsl:for-each select="$m">
<xsl:value-of select="name(.)/> <!-- No output -->
<xsl:value-of select="."/> <!-- Output: msg1msg2
-->
</xsl:for-each>
</xsl:template>
<xsl:template name="sortmsg">
<xsl:for-each select="/all/message">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
In the <xsl:for-each> loop must be the output two
times message, but I got no output and the loop is
pass only once.
I think that not the tree is copied with the
<xsl:copy-of> in the template sortmsg, but only the
values.
Before the currently c2.1 (cvs 12.12) version, I used
c2.1 (cvs 30.10) and with it works fine, but now not.
Marcel
--- Geoff Howard <co...@leverageweb.com> schrieb: >
sorry, didn't notice he had the root node matched.
> i was going too fast.
>
> Geoff
>
> > -----Original Message-----
> > From: Joerg Heinicke
> [mailto:joerg.heinicke@gmx.de]
> > Sent: Friday, December 13, 2002 4:55 AM
> > To: cocoon-users@xml.apache.org
> > Subject: Re: xsl:copy-of Problem
> >
> >
> > Geoff Howard wrote:
> > >>Hello Marcel,
> > >>
> > >>I wonder that anything is outputted. The output
> of the template
> > >>'sortmsg' is only stored in the variable $m, but
> there is nothing like
> > >><xsl:value-of select="$m"/>. If you use
> <xsl:copy-of select="$m"/>, the
> > >>tree is copied to the output. But I don't see,
> where the to strings come
> > >>from. Do you have a <xsl:apply-templates/>
> anywhere in your template
> > >>matching on the root node?
> > >
> > >
> > > The text nodes are probably coming from the
> default template,
> > which copies
> > > text nodes
> > > with value-of. After you add <xsl:copy-of
> select="$m"/> you'll
> > need to add
> > > empty template match patterns for text and/or
> message.
> > >
> > > I think there's also a default template that
> implies
> > xsl:apply-templates on
> > > the root node if no other template is specified
> for it.
> >
> > He seems to use a template matching on root node.
> In it there is no
> > <xsl:apply-templates/> (at least here in the
> mail). So the built-in
> > template can't be used and the text shell not
> appear in the output. But
> > it did as he said, so I asked for differences
> between the template in
> > the mail and this one he uses in Cocoon.
> >
> > Joerg
> >
> > >>Marcel Jurk wrote:
> > >>
> > >>>Hi,
> > >>>
> > >>>since I use Cocoon2.1 (CVS 12.12.2002) I have
> the
> > >>>following problem.
> > >>>When I use <xsl:copy-of select="."/> in a
> > >>>xsl-stylesheet, only the values form the
> elements are
> > >>>copied, but not the element itself, e.g. when I
> > >>>transform the following xml data:
> > >>><all>
> > >>> <message>
> > >>> <text>msg1<text>
> > >>> </message>
> > >>> <message>
> > >>> <text>msg2<text>
> > >>> </message>
> > >>></all>
> > >>>
> > >>>with the stylesheet:
> > >>>
> > >>><xsl:template match="/">
> > >>> <xsl:variable name="m">
> > >>> <xsl:call-template name="sortmsg"/>
> > >>> </xsl:variable>
> > >>></xsl:template>
> > >>>
> > >>><xsl:template name="sortmsg">
> > >>> <xsl:for-each select="/all/message">
> > >>> <xsl:copy-of select="."/>
> > >>> </xsl:for-each>
> > >>></xsl:template>
> > >>>
> > >>>then are only "msg1 msg2" is copied and not
> > >>>"<message>
> > >>> <text>msg1</text>
> > >>></message>
> > >>><message>
> > >>> <text>msg2</text>
> > >>></message>"
> > >>>
> > >>>I use the following transformer:
> > >>><map:transformer
> logger="sitemap.transformer.xsltc"
> > >>>name="xslt" pool-grow="2" pool-max="32"
> pool-min="8"
> >
>
>>>src="org.apache.cocoon.transformation.TraxTransformer">
> > >>>
> >
>
>>><use-request-parameters>false</use-request-parameters>
> > >>>
> >
>
>>><use-browser-capabilities-db>false</use-browser-capabilities-db>
> > >>>
> > >>>
> >
>
>><transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactor
> > >>yImpl</transformer-factory>
> > >>
> > >>></map:transformer>
> > >>>
> > >>>Does anyone know an answer.
> > >>>Thanks in advance,
> > >>>Marcel
> > >>>
> > >>>
> > >>>
> > >>>
> >
>
>>>__________________________________________________________________
> > >>>
> > >>>Gesendet von Yahoo! Mail - http://mail.yahoo.de
> > >>>Weihnachts-Einkäufe ohne Stress!
> http://shopping.yahoo.de
> > >>>
> >
>
>>>---------------------------------------------------------------------
> > >>>Please check that your question has not
> already been answered in the
> > >>>FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
> > >>>
> > >>>To unsubscribe, e-mail:
> <co...@xml.apache.org>
> > >>>For additional commands, e-mail:
> <co...@xml.apache.org>
> > >>>
> > >>>
> > >>
> >
>
>>---------------------------------------------------------------------
> > >>Please check that your question has not already
> been answered in the
> > >>FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
> > >>
> > >>To unsubscribe, e-mail:
> <co...@xml.apache.org>
> > >>For additional commands, e-mail:
> <co...@xml.apache.org>
> > >>
> > >>
> > >>
> > >
> > >
> > >
>
---------------------------------------------------------------------
> > > Please check that your question has not already
> been answered in the
> > > FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
> > >
> > > To unsubscribe, e-mail:
> <co...@xml.apache.org>
> > > For additional commands, e-mail:
> <co...@xml.apache.org>
> > >
> > >
> >
> >
> >
>
---------------------------------------------------------------------
> > Please check that your question has not already
> been answered in the
> > FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail:
> <co...@xml.apache.org>
> > For additional commands, e-mail:
> <co...@xml.apache.org>
> >
> >
> >
>
>
>
---------------------------------------------------------------------
> Please check that your question has not already
> been answered in the
> FAQ before posting.
> <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:
> <co...@xml.apache.org>
> For additional commands, e-mail:
> <co...@xml.apache.org>
>
__________________________________________________________________
Gesendet von Yahoo! Mail - http://mail.yahoo.de
Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: xsl:copy-of Problem
Posted by Geoff Howard <co...@leverageweb.com>.
sorry, didn't notice he had the root node matched. i was going too fast.
Geoff
> -----Original Message-----
> From: Joerg Heinicke [mailto:joerg.heinicke@gmx.de]
> Sent: Friday, December 13, 2002 4:55 AM
> To: cocoon-users@xml.apache.org
> Subject: Re: xsl:copy-of Problem
>
>
> Geoff Howard wrote:
> >>Hello Marcel,
> >>
> >>I wonder that anything is outputted. The output of the template
> >>'sortmsg' is only stored in the variable $m, but there is nothing like
> >><xsl:value-of select="$m"/>. If you use <xsl:copy-of select="$m"/>, the
> >>tree is copied to the output. But I don't see, where the to strings come
> >>from. Do you have a <xsl:apply-templates/> anywhere in your template
> >>matching on the root node?
> >
> >
> > The text nodes are probably coming from the default template,
> which copies
> > text nodes
> > with value-of. After you add <xsl:copy-of select="$m"/> you'll
> need to add
> > empty template match patterns for text and/or message.
> >
> > I think there's also a default template that implies
> xsl:apply-templates on
> > the root node if no other template is specified for it.
>
> He seems to use a template matching on root node. In it there is no
> <xsl:apply-templates/> (at least here in the mail). So the built-in
> template can't be used and the text shell not appear in the output. But
> it did as he said, so I asked for differences between the template in
> the mail and this one he uses in Cocoon.
>
> Joerg
>
> >>Marcel Jurk wrote:
> >>
> >>>Hi,
> >>>
> >>>since I use Cocoon2.1 (CVS 12.12.2002) I have the
> >>>following problem.
> >>>When I use <xsl:copy-of select="."/> in a
> >>>xsl-stylesheet, only the values form the elements are
> >>>copied, but not the element itself, e.g. when I
> >>>transform the following xml data:
> >>><all>
> >>> <message>
> >>> <text>msg1<text>
> >>> </message>
> >>> <message>
> >>> <text>msg2<text>
> >>> </message>
> >>></all>
> >>>
> >>>with the stylesheet:
> >>>
> >>><xsl:template match="/">
> >>> <xsl:variable name="m">
> >>> <xsl:call-template name="sortmsg"/>
> >>> </xsl:variable>
> >>></xsl:template>
> >>>
> >>><xsl:template name="sortmsg">
> >>> <xsl:for-each select="/all/message">
> >>> <xsl:copy-of select="."/>
> >>> </xsl:for-each>
> >>></xsl:template>
> >>>
> >>>then are only "msg1 msg2" is copied and not
> >>>"<message>
> >>> <text>msg1</text>
> >>></message>
> >>><message>
> >>> <text>msg2</text>
> >>></message>"
> >>>
> >>>I use the following transformer:
> >>><map:transformer logger="sitemap.transformer.xsltc"
> >>>name="xslt" pool-grow="2" pool-max="32" pool-min="8"
> >>>src="org.apache.cocoon.transformation.TraxTransformer">
> >>>
> >>><use-request-parameters>false</use-request-parameters>
> >>>
> >>><use-browser-capabilities-db>false</use-browser-capabilities-db>
> >>>
> >>>
> >><transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactor
> >>yImpl</transformer-factory>
> >>
> >>></map:transformer>
> >>>
> >>>Does anyone know an answer.
> >>>Thanks in advance,
> >>>Marcel
> >>>
> >>>
> >>>
> >>>
> >>>__________________________________________________________________
> >>>
> >>>Gesendet von Yahoo! Mail - http://mail.yahoo.de
> >>>Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
> >>>
> >>>---------------------------------------------------------------------
> >>>Please check that your question has not already been answered in the
> >>>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >>>
> >>>To unsubscribe, e-mail: <co...@xml.apache.org>
> >>>For additional commands, e-mail: <co...@xml.apache.org>
> >>>
> >>>
> >>
> >>---------------------------------------------------------------------
> >>Please check that your question has not already been answered in the
> >>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >>
> >>To unsubscribe, e-mail: <co...@xml.apache.org>
> >>For additional commands, e-mail: <co...@xml.apache.org>
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> >
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: xsl:copy-of Problem
Posted by Joerg Heinicke <jo...@gmx.de>.
Geoff Howard wrote:
>>Hello Marcel,
>>
>>I wonder that anything is outputted. The output of the template
>>'sortmsg' is only stored in the variable $m, but there is nothing like
>><xsl:value-of select="$m"/>. If you use <xsl:copy-of select="$m"/>, the
>>tree is copied to the output. But I don't see, where the to strings come
>>from. Do you have a <xsl:apply-templates/> anywhere in your template
>>matching on the root node?
>
>
> The text nodes are probably coming from the default template, which copies
> text nodes
> with value-of. After you add <xsl:copy-of select="$m"/> you'll need to add
> empty template match patterns for text and/or message.
>
> I think there's also a default template that implies xsl:apply-templates on
> the root node if no other template is specified for it.
He seems to use a template matching on root node. In it there is no
<xsl:apply-templates/> (at least here in the mail). So the built-in
template can't be used and the text shell not appear in the output. But
it did as he said, so I asked for differences between the template in
the mail and this one he uses in Cocoon.
Joerg
>>Marcel Jurk wrote:
>>
>>>Hi,
>>>
>>>since I use Cocoon2.1 (CVS 12.12.2002) I have the
>>>following problem.
>>>When I use <xsl:copy-of select="."/> in a
>>>xsl-stylesheet, only the values form the elements are
>>>copied, but not the element itself, e.g. when I
>>>transform the following xml data:
>>><all>
>>> <message>
>>> <text>msg1<text>
>>> </message>
>>> <message>
>>> <text>msg2<text>
>>> </message>
>>></all>
>>>
>>>with the stylesheet:
>>>
>>><xsl:template match="/">
>>> <xsl:variable name="m">
>>> <xsl:call-template name="sortmsg"/>
>>> </xsl:variable>
>>></xsl:template>
>>>
>>><xsl:template name="sortmsg">
>>> <xsl:for-each select="/all/message">
>>> <xsl:copy-of select="."/>
>>> </xsl:for-each>
>>></xsl:template>
>>>
>>>then are only "msg1 msg2" is copied and not
>>>"<message>
>>> <text>msg1</text>
>>></message>
>>><message>
>>> <text>msg2</text>
>>></message>"
>>>
>>>I use the following transformer:
>>><map:transformer logger="sitemap.transformer.xsltc"
>>>name="xslt" pool-grow="2" pool-max="32" pool-min="8"
>>>src="org.apache.cocoon.transformation.TraxTransformer">
>>>
>>><use-request-parameters>false</use-request-parameters>
>>>
>>><use-browser-capabilities-db>false</use-browser-capabilities-db>
>>>
>>>
>><transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactor
>>yImpl</transformer-factory>
>>
>>></map:transformer>
>>>
>>>Does anyone know an answer.
>>>Thanks in advance,
>>>Marcel
>>>
>>>
>>>
>>>
>>>__________________________________________________________________
>>>
>>>Gesendet von Yahoo! Mail - http://mail.yahoo.de
>>>Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
>>>
>>>---------------------------------------------------------------------
>>>Please check that your question has not already been answered in the
>>>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>>>
>>>To unsubscribe, e-mail: <co...@xml.apache.org>
>>>For additional commands, e-mail: <co...@xml.apache.org>
>>>
>>>
>>
>>---------------------------------------------------------------------
>>Please check that your question has not already been answered in the
>>FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>>
>>To unsubscribe, e-mail: <co...@xml.apache.org>
>>For additional commands, e-mail: <co...@xml.apache.org>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
RE: xsl:copy-of Problem
Posted by Geoff Howard <co...@leverageweb.com>.
> Hello Marcel,
>
> I wonder that anything is outputted. The output of the template
> 'sortmsg' is only stored in the variable $m, but there is nothing like
> <xsl:value-of select="$m"/>. If you use <xsl:copy-of select="$m"/>, the
> tree is copied to the output. But I don't see, where the to strings come
> from. Do you have a <xsl:apply-templates/> anywhere in your template
> matching on the root node?
The text nodes are probably coming from the default template, which copies
text nodes
with value-of. After you add <xsl:copy-of select="$m"/> you'll need to add
empty template match patterns for text and/or message.
I think there's also a default template that implies xsl:apply-templates on
the root node if no other template is specified for it.
>
> Joerg
>
> Marcel Jurk wrote:
> > Hi,
> >
> > since I use Cocoon2.1 (CVS 12.12.2002) I have the
> > following problem.
> > When I use <xsl:copy-of select="."/> in a
> > xsl-stylesheet, only the values form the elements are
> > copied, but not the element itself, e.g. when I
> > transform the following xml data:
> > <all>
> > <message>
> > <text>msg1<text>
> > </message>
> > <message>
> > <text>msg2<text>
> > </message>
> > </all>
> >
> > with the stylesheet:
> >
> > <xsl:template match="/">
> > <xsl:variable name="m">
> > <xsl:call-template name="sortmsg"/>
> > </xsl:variable>
> > </xsl:template>
> >
> > <xsl:template name="sortmsg">
> > <xsl:for-each select="/all/message">
> > <xsl:copy-of select="."/>
> > </xsl:for-each>
> > </xsl:template>
> >
> > then are only "msg1 msg2" is copied and not
> > "<message>
> > <text>msg1</text>
> > </message>
> > <message>
> > <text>msg2</text>
> > </message>"
> >
> > I use the following transformer:
> > <map:transformer logger="sitemap.transformer.xsltc"
> > name="xslt" pool-grow="2" pool-max="32" pool-min="8"
> > src="org.apache.cocoon.transformation.TraxTransformer">
> >
> > <use-request-parameters>false</use-request-parameters>
> >
> > <use-browser-capabilities-db>false</use-browser-capabilities-db>
> >
> >
> <transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactor
> yImpl</transformer-factory>
> > </map:transformer>
> >
> > Does anyone know an answer.
> > Thanks in advance,
> > Marcel
> >
> >
> >
> >
> > __________________________________________________________________
> >
> > Gesendet von Yahoo! Mail - http://mail.yahoo.de
> > Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
> >
> > ---------------------------------------------------------------------
> > Please check that your question has not already been answered in the
> > FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
> >
> > To unsubscribe, e-mail: <co...@xml.apache.org>
> > For additional commands, e-mail: <co...@xml.apache.org>
> >
> >
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: xsl:copy-of Problem
Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Marcel,
I wonder that anything is outputted. The output of the template
'sortmsg' is only stored in the variable $m, but there is nothing like
<xsl:value-of select="$m"/>. If you use <xsl:copy-of select="$m"/>, the
tree is copied to the output. But I don't see, where the to strings come
from. Do you have a <xsl:apply-templates/> anywhere in your template
matching on the root node?
Joerg
Marcel Jurk wrote:
> Hi,
>
> since I use Cocoon2.1 (CVS 12.12.2002) I have the
> following problem.
> When I use <xsl:copy-of select="."/> in a
> xsl-stylesheet, only the values form the elements are
> copied, but not the element itself, e.g. when I
> transform the following xml data:
> <all>
> <message>
> <text>msg1<text>
> </message>
> <message>
> <text>msg2<text>
> </message>
> </all>
>
> with the stylesheet:
>
> <xsl:template match="/">
> <xsl:variable name="m">
> <xsl:call-template name="sortmsg"/>
> </xsl:variable>
> </xsl:template>
>
> <xsl:template name="sortmsg">
> <xsl:for-each select="/all/message">
> <xsl:copy-of select="."/>
> </xsl:for-each>
> </xsl:template>
>
> then are only "msg1 msg2" is copied and not
> "<message>
> <text>msg1</text>
> </message>
> <message>
> <text>msg2</text>
> </message>"
>
> I use the following transformer:
> <map:transformer logger="sitemap.transformer.xsltc"
> name="xslt" pool-grow="2" pool-max="32" pool-min="8"
> src="org.apache.cocoon.transformation.TraxTransformer">
>
> <use-request-parameters>false</use-request-parameters>
>
> <use-browser-capabilities-db>false</use-browser-capabilities-db>
>
> <transformer-factory>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</transformer-factory>
> </map:transformer>
>
> Does anyone know an answer.
> Thanks in advance,
> Marcel
>
>
>
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Weihnachts-Einkäufe ohne Stress! http://shopping.yahoo.de
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>