Re: [xsl] Some Pointers on XSLT 2.0 vs. 1.0 and for Using XSLT 2.0 on the Web

Subject: Re: [xsl] Some Pointers on XSLT 2.0 vs. 1.0 and for Using XSLT 2.0 on the Web
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Mon, 13 Oct 2008 19:55:13 -0400
On Oct 13, 2008, at 1:55 PM, Jesse Heines wrote:

I have been using XSLT 1.0 for many years to render Java Server Pages on my
website (http://teaching.cs.uml.edu/~heines) from data stored in XML files.

I do this quite a bit. You would be much happier with JSP 2.0 with JSTL and the Expression Language. It is very XML friendly (and therefore XSL friendly).


Also, you could get rid of the font element with a simple (external) CSS style. JSTL has an XSL 1.0 like syntax. Expression language is somewhat similar to attribute value templates (but you can use them anywhere).

<div>
  <xsl:if test="$test=val">
    <xsl:attribute name="class">blah</xsl:attribute>
  </xsl:if>
</div>

The only clumsy thing at this point is because of danged SGML legacy things like checked=checked, selected=selected. What I do is generate these into the JSP like so:

<input type="radio"
  name="bar"
  value="foo${obj.bar='foo' ? '& quot; checked=& quot;checked' : ''}"/>

Ugly, but at least you can generate it from one place in the XSL and not have to write it for each input.

best,
-Rob

Current Thread