[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Literal Text

Subject: RE: Literal Text
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 29 Mar 1999 10:55:44 +0100
xsl tag text
Title: RE: Literal Text

> Given this XSL:
>
> <xsl:text>&lt;/JPanel&gt;</xsl:text>
>
> When run through Lotus XSL Processor I get this output:
>
> &lt;/JPanel&gt;
>
> When I really want:
>
> </JPanel>
>
> What am I doing wrong?
>
Misunderstanding one of the underlying concepts of XSL, which is that it produces a tree rather than a stream of characters.

If it's of any interest, SAXON's "almost-XSL" processor does allow you to produce any stream of characters, including XML, HTML, badly-formed-XML, and things-that-aren't-XML-at-all. If you have a valid reason for wanting the characters "</JPanel>" in your output, you can do it in two ways in SAXON:

1: <xsl:tag>/JPanel</xsl:tag>

or

2: <xsl:text saxon:escape="no">&lt;/JPanel&gt;</xsl:text>

The former approach is there primarily to handle the case where you do want to output well-formed XML, but you have to suppress compile-time checking to achieve it (rather like a cast). An example would be:

  <xsl:if test=".[first-of-type()]">
    <xsl:tag>JPanel</xsl:tag>
  </xsl:if>
        ...
  <xsl:if test=".[last-of-type()]">
    <xsl:tag>/JPanel</xsl:tag>
  </xsl:if>

The second approach is there primarily to handle the case where the output is not *ML at all, e.g. it might be a CSV file.

Mike Kay

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.