* Trevor Parscal <tparscal(a)wikimedia.org> [Wed, 08 Dec 2010 07:31:33
-0800]:
On 12/7/10 10:46 PM, Dmitriy Sintsov wrote:
* 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 :)
I was talking about using recursion to generate repeated content:
http://www.ibm.com/developerworks/xml/library/x-tiploop.html
You are right that XSL is powerful and worth, however it didn't gain
huge popularity despite being invented many years ago. The source code
is not well readable and too long due to embedding of language
constructions in tags. However, MediaWiki probably would be OK to use
it, because many of MediaWiki users are advanced users and scientists.
Ordinary people would be scared of both wiki parser templates and XSL.
XQuery is probably under development and not ready yet.
Dmitriy