[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: cdata-section-elements - not wrapping real xml in
Wendell Piez wrote: > Sent: Monday, November 10, 2003 3:43 PM > I think what you need is to write out the "elements" inside > the string you > want to preserve in escaped form. You can do this with > templates easily > enough. This means they won't look like elements in your > stylesheet -- > because you don't want elements in your output. For example > (here are a > couple of templates I have lying around that will do this): Thank you for these. They were just what I needed for something I'm doing. (Caveat to anyone who might use this: a greater-than sign is missing in the "write-endtag" template as it appeared in the email.) > <xsl:template name="write-starttag"> > <xsl:text><</xsl:text> > <xsl:value-of select="local-name()"/> > <xsl:for-each select="@*"> > <xsl:call-template name="write-attribute"/> > </xsl:for-each> > <xsl:text>></xsl:text> > </xsl:template> > > <xsl:template name="write-endtag"> > <xsl:text></</xsl:text> > <xsl:value-of select="local-name()"/> > <xsl:text></xsl:text> A greater-than sign is missing here (lost in the mail?) > </xsl:template> > > <xsl:template name="write-attribute"> > <xsl:text> </xsl:text> > <xsl:value-of select="local-name()"/> > <xsl:text>="</xsl:text> > <xsl:value-of select="."/> > <xsl:text>"</xsl:text> > </xsl:template> > > <xsl:template match="*" mode="escape-xml"> > <xsl:call-template name="write-starttag"/> > <xsl:apply-templates/> Btw some will want to add mode="escape-xml" to the above line for recursive escaping. > <xsl:call-template name="write-endtag"/> > </xsl:template> > > <xsl:template match="warning"> > <xsl:apply-templates mode="escape-xml"/> > </xsl:template> Lars XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|