* Ashar Voultoiz<hashar+wmf(a)free.fr> [Tue, 07
Dec 2010 19:19:53 +0100]:
On 06/12/10 16:57, Trevor Parscal wrote:
I personally think XSL is awesome, and would
defend it with
vigor.
I love XSL too. Probably the easiest way to render an XML data file.
It's easy only when XSL style sheet already exists. Even simple loops
were not so easy to peform in that language, at least in old v1.0 I've
used some years ago. And expressions enclosed in tags are bloated.
XQuery has easy loops and much less bloat, however it's much less
supported in PHP.
Loops? Maybe you weren't using XSL the way it's meant to
be used? In XSL
templates are just applied to the data. Consider the case of mixed node
types within a common parent...
<!-- given this data -->
<root>
<child name="a" />
<something-else name="d" />
<child name="b" />
<child name="c" />
</root>
<!-- using this stylesheet -->
<xsl:template name="root">
<ul><xsl:apply-templates /></ul>
</xsl:template>
<xsl:template name="child">
<li><xsl:value-of select="@name" /></li>
</xsl:template>
<xsl:template name="something-else">
<li><strong><xsl:value-of select="@name"
/></strong></li>
</xsl:template>
<!-- resulting output would be -->
<ul>
<li>a</li>
<li><strong>d</strong></li>
<li>b</li>
<li>c</li>
</ul>
I warned that I would defend XSL with vigor :)
- Trevor