xsl-list
[Top] [All Lists]

RE: [xsl] Result tree fragment to string?

2008-08-27 13:08:59
From: Martin Honnen [mailto:Martin(_dot_)Honnen(_at_)gmx(_dot_)de]
Sent: Wednesday, August 27, 2008 1:56 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Result tree fragment to string?

Houghton,Andrew wrote:

Hmm... could he do something like:

<xsl:variable name="xml">
  <xsl:call-template name="serialize-tree">
    <xsl:with-param name="nodes" select="$result-tree" />
  </xsl:call-template>
</xsl:variable>

<xsl:template name="serialize-tree">
  <xsl:param name="nodes" />
  <xsl:apply-templates select="$nodes" mode="serialize" />


The above doesn't handle namespaces, processing-instructions,
comments,
or mixed content, but it could be hacked to do so.  Is there a reason
why this approach would not work in XSL 1.0 to satisfy his needs?

Yes, the reason is that you can't do the apply-templates on the result
tree fragment, you would first need to convert it to a node-set with an
extension function.

Oops, I thought his result tree was a node set, not a string...

What if he created a recursive template that parsed the XML string to
determine where elements, attributes and text strings occurred?


Andy.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--