cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Chamberlain <an...@comsine.co.uk>
Subject Re: Tags in the value of an XSLT variable?
Date Mon, 30 Jun 2008 12:56:23 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Andreas,<br>
<br>
That's a good tip about passing the fragment as a Node instead of a
String.&nbsp; It didn't occur to me because I mistakenly thought that only
primitive-type variables could be passed from Cocoon to Java.<br>
<br>
Thanks,<br>
<br>
Andy<br>
<br>
<hr size="2" width="100%"><br>
Andreas Hartmann wrote:
<blockquote cite="mid:g4ai16$3fl$1@ger.gmane.org" type="cite">
  <pre wrap="">Andrew Chamberlain schrieb:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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:

    &lt;xsl:variable name="gml"&gt;
      &lt;xsl:copy-of select="@* | node()"/&gt;
    &lt;/xsl:variable&gt;

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?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
That would be XML serializing. AFAIK XSLT is not capable of this (I
don't know about XSLT 2.0, though). Why do you have to convert the
fragment to a string? Wouldn't it be more straightforward to pass the
fragment to the Java code, so that it doesn't have to be parsed again?

-- Andreas


  </pre>
  <blockquote type="cite">
    <pre wrap="">Best regards,

Andy

------------------------------------------------------------------------

Derek Hohls wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">And that is not a "trick", but standard XSLT; see:
<a class="moz-txt-link-freetext" href="http://www.dpawson.co.uk/xsl/sect2/N1930.html#d3389e91">http://www.dpawson.co.uk/xsl/sect2/N1930.html#d3389e91</a>
as select="." only selects the value (string) inside the tag/s.


      </pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">On 2008/06/27 at 06:48, in message <a class="moz-txt-link-rfc2396E"
href="mailto:2415.207.168.47.25.1214585293.squirrel@www.eccnet.com">&lt;2415.207.168.47.25.1214585293.squirrel@www.eccnet.com&gt;</a>,
"Betty Harvey" <a class="moz-txt-link-rfc2396E" href="mailto:harvey@eccnet.com">&lt;harvey@eccnet.com&gt;</a>
wrote:

            </pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre wrap="">Try this for your xsl:copy:

&lt;xsl:copy&gt;&lt;xsl:apply-templates select="@* | node()" /&gt;&lt;/xsl:copy&gt;

&lt;quote who="Andrew Chamberlain"&gt;

      </pre>
      <blockquote type="cite">
        <pre wrap="">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:

    &lt;xsl:variable name="gml"&gt;
      &lt;xsl:copy-of select="."/&gt;
    &lt;/xsl:variable&gt;

Can anyone help?  Is there a trick for this?

Many thanks,

Andy

        </pre>
      </blockquote>
      <pre wrap="">

--
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 <a class="moz-txt-link-freetext" href="http://www.csir.co.za/disclaimer.html">http://www.csir.co.za/disclaimer.html</a>.

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: <a class="moz-txt-link-abbreviated" href="mailto:users-unsubscribe@cocoon.apache.org">users-unsubscribe@cocoon.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:users-help@cocoon.apache.org">users-help@cocoon.apache.org</a>

.


      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->

--
Andreas Hartmann, CTO
BeCompany GmbH
<a class="moz-txt-link-freetext" href="http://www.becompany.ch">http://www.becompany.ch</a>
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:users-unsubscribe@cocoon.apache.org">users-unsubscribe@cocoon.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:users-help@cocoon.apache.org">users-help@cocoon.apache.org</a>

.

  </pre>
</blockquote>
</body>
</html>

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


Mime
View raw message