Subject: RE: [xsl] Displaying document( ) output within CDATA From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 28 Jun 2001 12:05:09 +0100 |
<xsl:template match="example"> <xsl:apply-templates select="document(@file)" mode="tagged"/> </xsl:template>
<xsl:template match="*" mode="tagged"> <xsl:value-of select="concat('<', local-name())"/> <xsl:apply-templates select="@*" mode="tagged"/> <xsl:text>></xsl:text> <xsl:apply-templates select="node()" mode="tagged"/> <xsl:value-of select="concat('</', local-name(), '>')"/> </xsl:template>
<xsl:template match="@*" mode="tagged"> <xsl:value-of select="concat(' ', local-name(), '="')"/> <xsl:value-of select="."/> <xsl:value-of select="'"'"/> </xsl:template>
<xsl:template match="text()" mode="tagged"> <xsl:value-of select="."/> </xsl:template>
Regards, Wendell
Really, you want to avoid parsing the example XML in the first place, which then reduces to the problem of loading a non-XML text file as a string value. You can do this easily enough with an extension function, or with a JAXP processor you could write a URIResolver that bypasses the parsing.
Another approach is to write your own serializer (subclassing or pipelining into the standard one for your chosen processor). Then instead of reading the example file into the transformation, the transformation can output a processing instruction containing a reference to the file, and your serializer can expand this reference by fetching the file and including its contents.
Mike Kay Software AG
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Displaying document( ) ou, Michael Kay | Thread | Re: [xsl] Displaying document( ) ou, Adam Turoff |
Re: [xsl] Re: Displaying document( , Oliver Becker | Date | Re: [xsl] Avoiding selection of UNR, Wendell Piez |
Month |