xsl-list
[Top] [All Lists]

RE: [xsl] A beef with XSLT Sometimes too complicated

2006-07-14 00:24:10
I too am annoyed by the syntax. My pet peev is that 
xsl:attribute has to be the first element. This is really 
annoying if you want to optionally add an attribute.

xsl:attribute is not necessarily the first child element within
xsl:template or xsl:element, but does need to follow element insertion
directly.

VALID:

<xsl:element name="dummy">
  <xsl:attribute name="id">bla</xsl:attribute>
</xsl:element>

<xsl:element name="dummy">
  <xsl:variable name="test" />
  <xsl:attribute name="id">bla</xsl:attribute>
</xsl:element>

<xsl:element name="dummy">
  <xsl:call-template name="copy-some-attributes"/>
  <xsl:call-template name="doesnt-write-to-target-tree"/>
  <xsl:attribute name="id">bla</xsl:attribute>
</xsl:element>

<xsl:element name="dummy">
  <xsl:variable name="myrtf">
    <xsl:call-template
name="calculate-tree-fragment-with-comments-elems-etc"/>
  </xsl:variable>
  <xsl:attribute name="id">bla</xsl:attribute>
</xsl:element>

<xsl:element name="dummy">
  <xsl:variable name="mybool">
    <xsl:if test="$x = 'y'">YES!</xsl:if>
  </xsl:variable>
  <xsl:if test="$mybool = 'YES!'"> <!-- ignore the silly boolean
statements ;-) -->
    <xsl:attribute name="id">bla</xsl:attribute>
  </xsl:if>
</xsl:element>

INVALID:

<xsl:element name="dummy">
  <xsl:comment>Not allowed here!</xsl:comment>
  <xsl:attribute name="id">bla</xsl:attribute>
</xsl:element>

<xsl:element name="dummy">
  <xsl:processing-instruction name="test">Not allowed
here!</xsl:processing-instruction>
  <xsl:attribute name="id">bla</xsl:attribute>
</xsl:element>

<xsl:element name="dummy">
  <xsl:call-template
name="calculate-tree-fragment-with-comments-elems-etc"/>
  <xsl:attribute name="id">bla</xsl:attribute>
</xsl:element>

Kind regards,
Geert
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl


De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>