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

<% ... %> and html output method


Subject: <% ... %> and html output method
From: Mark Hayes <mark@xxxxxxxxxxx>
Date: Tue, 23 Nov 1999 09:22:05 -0800

Hi,

When I use XSLT with the html output method, often I'm actually producing
JSP files.  In the currently shipping versions of JSP, the JSP file cannot
be a valid XML document because the use of <%, <%= and %> in JSP files
really is necessary for directives as well as script snippets.  The
alternatives (I can think of) for outputting the <%= ... %> sections are
below.  If anyone has used the XT tag extension mechanism, please let me
know if you think that option might work.

If the desired output document should contain:

	<h1> <%= request.getParameter("title") %> </h1>

1- In the stylesheet I can use <xsl:text> with disable-output-escaping as
shown below.  Obviously, this is very verbose and I'd like to avoid it.

	<h1>
	<xsl:text disable-output-escaping='yes'> &lt;%= </xsl:text>
	request.getParameter("title")
	<xsl:text disable-output-escaping='yes'> %&gt; </xsl:text>
	</h1>

2- I could hope that the html output method will eventually support
<%=>...</%=> in the stylesheet and do the right thing with the output.  See
below.  In the meantime, I could hack XT (which I'm using) to try to make
this work -- this would probably be difficult since % is not valid in an
element name.  It seems likely that this would become nothing more than my
own proprietary syntax, which I would also like to avoid.

	<h1> <%=> request.getParameter("title") </%=> </h1>

3- I could try using the extension tag mechanism to create tags that would
be used as below and expanded by my XT hacks into the desired output.  I
haven't looked at XT to see how difficult this would be.  It would be my own
proprietary syntax, but at least I would have a chance of making it work in
other XSLT processors in the future.

	<h1> <my:write> request.getParameter("title") </my:write> </h1>

I'm tending toward trying 3 at the moment.  Or perhaps I could combine 2 and
3 -- use the tag extension to add the <%=> tag.  Any thoughts?

thanks,
mark


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



Current Thread
Keywords