[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] How to convert a whold result tree to a string?


Subject: Re: [xsl] How to convert a whold result tree to a string?
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 02 Dec 2002 16:14:53 -0500

The Saxon 7 extension function serialize does that.

But why would you want to do that? Unless you're doing funky
stuff, you're always better off with having the XML as a real
node set.

If you want to turn XML into text for direct rendering, consider
writing a transform that does that. For example, I needed to
place sample XML 'code' into a text document verbatim. So,
what I did is to write a bunch of templates in mode="verbatim"
that would do this type of serialization. Is that obsolete
with Saxon's serialize() function? No, not at all! Because
with my templates, I can put special handlin for special forms
to do the type of syntax markup (coloring) that we are all
used to from looking at raw XML in Explorer or Spy.

regards
-Gunther

Fengrui Gu wrote:

Suppose I have a result tree like
<test>
<test1> kkkk</tes1>
<test2 attr="kkkk"/>
</test>

Can I store it in a string variable like <xsl:template match="test>
<xsl:variable name="str" select="string(.)"/>
</xsl:template>


So whenever I use <xsl:value-of select="$str"/>, it will output
the whole result tree as string.


Obvioulsy, the code doesn't work because string function only converts the first element.

any ideas?

thanks,
Fengrui




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



--
Gunther Schadow, M.D., Ph.D.                    gschadow@xxxxxxxxxxxxxxx
Medical Information Scientist      Regenstrief Institute for Health Care
Adjunct Assistant Professor        Indiana University School of Medicine
tel:1(317)630-7960                         http://aurora.regenstrief.org



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml