Re: [xsl] Caching XML document as a string...

Subject: Re: [xsl] Caching XML document as a string...
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 18 Jan 2002 10:02:03 +0000
Hi Seema,

> In the XSL file I need to cache this entire XML in a hidden input field as a
> single string.
> <td><input type="hidden" value="The ENTIRE xml String" name="cache"</td>

To do that, you need to serialize the XML within your stylesheet.
Unfortunately, because you want this to work in Netscape as well, you
can't use MSXML to create a script to do it (which is the easiest
way).

Instead, you need something like Evan's xml-to-string.xsl stylesheet
(http://xmlportfolio.com/xml-to-string/) to serialize the XML into a
string. Follow the instructions there, but basically you want to
import the stylesheet and then call the xml-to-string template,
passing the root node of the XML as the value of the node-set
parameter, with something like:

  <input type="hidden" name="cache">
    <xsl:attribute name="value">
      <xsl:call-template name="xml-to-string">
        <xsl:with-param name="node-set" select="/" />
      </xsl:call-template>
    </xsl:attribute>
  </input>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread