[xsl] SVG object creation with XSLT using successive abstraction layers

Subject: [xsl] SVG object creation with XSLT using successive abstraction layers
From: Luis Vielva <luisvielva@xxxxxxxxx>
Date: Thu, 3 Nov 2005 19:04:07 +0100
I am using XSLT to generate SVG code from an XML page description.

I have identified different objects as primitives (buttons, labels, ...)
that I call "basic objects".

I have also identified "higher level" objects that could be built by using
basic
objects.

I would like to use on the same XML page description both "basic" and
"higher"
level objects. Something like this:

<page>
    <basic id="a" x="10" y="100" />
    <higher id="b" x="40" y="200" />
</page>

My problem is with the XSLT. I have tried something like this:

<xsl:template match="basic">
...
Here goes the expression of a basic object in SVG code
...
</xsl:template>

<xsl:template match="higher">
    <basic id=".0" x="100" y="200" />
    <basic id=".1" x="110" y="200" />

    <xsl:apply-templates select="basic" />
</xsl:template>


<xsl:template match="page">
   <xsl:apply-templates select="higher" />
   <xsl:apply-templates select="basic" />
</xsl:template>


What I would like to obtain is that once the "higher" level object
is expanded in terms of the "basic" objects (by the match="higher"
template), the constitutive "basic" objects could be expanded
into SVG code.

I would like to be able to use this paradigm of expressing higher level
objects in terms of basic ones in an scenario with an arbitrary
number of layers, not only two as I comment here for clarity.

Could any one of you provide me with a clue?


Best regards,

Luis Vielva.

Current Thread