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

[Saxon] <xsl:choose> inside <xsl:attribute-set>

Subject: [Saxon] <xsl:choose> inside <xsl:attribute-set>
From: David Allouche <david@xxxxxxxxxxxxxxxx>
Date: Thu, 17 Aug 2000 16:21:51 -0200 (GMT+2)
xslt xsl choose attribute
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


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.