This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
[Saxon] <xsl:choose> inside <xsl:attribute-set>
- To: XSL mailing-list <xsl-list at mulberrytech dot com>
- Subject: [Saxon] <xsl:choose> inside <xsl:attribute-set>
- From: David Allouche <david at ansible dot xlii dot org>
- Date: Thu, 17 Aug 2000 16:21:51 -0200 (GMT+2)
- Reply-To: xsl-list at mulberrytech dot com
First, I would like to thank Nikolai Grigoriev and Sebastian Rahtz for
their very helpful answers to my question about using CSS to emulate FO.
I am now woking at outputting CSS enriched HTML as Sebastian suggested.
I have a problem wich looks very much like a bug in Saxon.
I am using Saxon 5.4.1.
- - - toto.xsl - - -
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:attribute-set name="foo">
<xsl:attribute name="bar">
<xsl:choose>
<xsl:when test="/toto">Toto</xsl:when>
<xsl:otherwise>Not Toto</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="/">
<toto xsl:use-attribute-set="foo"/>
</xsl:template>
</xsl:stylesheet>
- - - - - - - - - -
$ java com.icl.saxon.StyleSheet toto.xml toto.xsl
Failed to compile style sheet
At xsl:choose on line 8 of file:/home/david/tmp/toto.xsl: Element must
only be used within a template
- - - XSLT Programmer's Reference (p. 164) - - -
An attribute set in not simply a textual macro. The attributes contained
in the attribute set each have a template body to define the value, and
although this will often be a simple text node, it may also, for example,
declare variables or invoke other XSLT instructions such as
<xsl:call-template> and <xsl:apply-templates>.
- - - - - - - - - - - - - - - - - - - - - - - - -
Is there actually a contradiction, or a I am misunderstanding something ?
Actually, I can work around the problem by using named templates instead
of attribute sets, but using attribute sets gives a useful clue to the
human reader (I am working on an semi-automated conversion tool).
Moreover this upsets me as a wrongness in my grokking of XSLT.
-- David --
PS: Kay's book is the One True Book (tm) on XSLT
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list