You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Wei Tjong <we...@magix.com.sg> on 2003/06/01 08:15:37 UTC

Re: whitespaces using xsl:copy-of

Hi Stephan,

Try <xsl:strip-space elements="tagA"/>.  This is a top level element, so it
must come after the <xsl:stylesheet> element.

Best regards,
Liaw Wei Tjong

----- Original Message ----- 
From: Stefan Pietschmann
To: cocoon-users@xml.apache.org
Sent: Sunday, June 01, 2003 12:39 AM
Subject: whitespaces using xsl:copy-of


hi guys,

at the moment I'm writing a Transformer for Cocoon 2.0.4 and my problem is
as follows:

There are certain tags not touched by the xslt a step earlier in the
pipeline and I want to read them out. let's say the structure is:

<tagA>
    <sub/>
</tagA>

Now I simply use xsl:copy-of in my XSLT to copy tagA over in the output, so
I am able to read it out in the following Transformer step.
There I can search for tagA and make it a Node variable. I want to check
whether the first childnode of it is called "sub" or "seb".
When I just output all the childnodes of tagA with their names
(getNodeName()) I get
child1: "#text:     "
child2: "sub: ...."
child3: "#text:    "

well, it seems obvious that there are whitespaces before and after the sub
tag, which occur when using copy-of with an indented (a.k.a pretty-printed)
document.
 If i change the original to be like <tagA><sub/></tagA> sub is the first
and only childnode, otherwise not.

Now the question: Can I somehow get rid of whitespaces between tags when
copying tagA over to the output in my xslt?

Thanx for your help and I hope you got what i meant :P

Stefan Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: whitespaces using xsl:copy-of

Posted by Stefan Pietschmann <St...@inf.tu-dresden.de>.
Thanx alot,

that worked like a charm ;)

regards,
Stefan

----- Original Message ----- 
From: "Wei Tjong" <we...@magix.com.sg>
To: <co...@xml.apache.org>
Sent: Sunday, June 01, 2003 8:15 AM
Subject: Re: whitespaces using xsl:copy-of


> Hi Stephan,
>
> Try <xsl:strip-space elements="tagA"/>.  This is a top level element, so
it
> must come after the <xsl:stylesheet> element.
>
> Best regards,
> Liaw Wei Tjong
>
> ----- Original Message ----- 
> From: Stefan Pietschmann
> To: cocoon-users@xml.apache.org
> Sent: Sunday, June 01, 2003 12:39 AM
> Subject: whitespaces using xsl:copy-of
>
>
> hi guys,
>
> at the moment I'm writing a Transformer for Cocoon 2.0.4 and my problem is
> as follows:
>
> There are certain tags not touched by the xslt a step earlier in the
> pipeline and I want to read them out. let's say the structure is:
>
> <tagA>
>     <sub/>
> </tagA>
>
> Now I simply use xsl:copy-of in my XSLT to copy tagA over in the output,
so
> I am able to read it out in the following Transformer step.
> There I can search for tagA and make it a Node variable. I want to check
> whether the first childnode of it is called "sub" or "seb".
> When I just output all the childnodes of tagA with their names
> (getNodeName()) I get
> child1: "#text:     "
> child2: "sub: ...."
> child3: "#text:    "
>
> well, it seems obvious that there are whitespaces before and after the sub
> tag, which occur when using copy-of with an indented (a.k.a
pretty-printed)
> document.
>  If i change the original to be like <tagA><sub/></tagA> sub is the first
> and only childnode, otherwise not.
>
> Now the question: Can I somehow get rid of whitespaces between tags when
> copying tagA over to the output in my xslt?
>
> Thanx for your help and I hope you got what i meant :P
>
> Stefan Pietschmann
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org