cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Re: Tags in the value of an XSLT variable?
Date Mon, 30 Jun 2008 11:27:37 GMT
Andy

This is confusing.  In your original post, you said you wanted to:
"capture a tree fragment in the value of variable ... including the tags themselves"
This is now what you have.

I am also not sure how you differentiate between a Node Tree vs a String.
At the end, XML is just plain text.  The fact that it has pointy brackets in it
is because we assume that the processing software will be able to make use
of it.  So I think the answer lies in the Java code you have written - if it treats
the incoming variable as just having plain text, then the brackets should make
no difference.  Maybe you need to expand more on what you want to happen
on the Java side.... (tho' that is probably outside my scope of expertise)

Derek

>>> On 2008/06/30 at 01:15, in message <4868C04B.8010507@comsine.co.uk>, Andrew
Chamberlain <andyc@comsine.co.uk> wrote:
Hi Betty/Derek,

Thanks for getting back.

Yes, that's certainly helped.  I'm now confident that my variable also contains the tags in
addition to the values.  It was by changing the "." for "@* | node()" that did it.

So my xslt looks like this:
<xsl:variable name="gml">      <xsl:copy-of select="@* | node()"/>    </xsl:variable>
However, I now believe this variable is still a Node-Tree, and not a String. 
 I need it to be the latter so I can pass the XML excerpt to the Java method
 I mentioned earlier (using xalan to do so).

Is there a way of casting/translating a node tree into a String?

Best regards,

Andy


Derek Hohls wrote: 

And that is not a "trick", but standard XSLT; see:http://www.dpawson.co.uk/xsl/sect2/N1930.html#d3389e91as
select="." only selects the value (string) inside the tag/s.


On 2008/06/27 at 06:48, in message <2415.207.168.47.25.1214585293.squirrel@www.eccnet.com>
( mailto:2415.207.168.47.25.1214585293.squirrel@www.eccnet.com ), "Betty Harvey" <harvey@eccnet.com>
( mailto:harvey@eccnet.com ) wrote:
        Try this for your xsl:copy:
<xsl:copy><xsl:apply-templates select="@* | node()" /></xsl:copy><quote
who="Andrew Chamberlain">  

Hi All,

It's quite possible that this is more XSLT-related than Cocoon itself,
but wasn't sure where else to post.

I'm using an XSL transformer and need to capture a tree fragment in the
value of variable ... including the tags themselves.  The reason for
this is because I need to pass the XML excerpt (as a string) to a Java
class which is specifically written to parse it.

I'm trying the following, but this only seems to include the values, and
not the tags:

    <xsl:variable name="gml">      <xsl:copy-of select="."/>    </xsl:variable>
Can anyone help?  Is there a trick for this?

Many thanks,

Andy



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice,
and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Mime
View raw message