I am new to XSL/XML. I came across 2 problems when trying to write XSL
for converting XML
cocuments to HTML. The xsl processor I used is Koala Xsl engine.
First, I want to generate a comma separated list similar to
a1, a2, a3
From the following xml:
<col name="a1"/>
<col name="a2"/>
<col name="a3'/>
I used the following rules, but the Koala processor reported an
error, complaining both rules are
the same.
<xls:template match='col[last-of-type()]'>
<xsl:value-of expr="attribute(name)"/>
<xsl:text>,</xsl:text>
</xsl:template>
<xsl:template match='col'>
<xsl:value-of expr="attribute(name)"/>
</xsl:template>
What I did wrong here? If so, how do you generate the list?
The second problem I have is:
From XML:
<table name="TAB1">
<columns>
<col name=......../>
<col name=...../>
</columns>
<indexs>
....
</indexs>
</table>
Desired output is:
Create table TAB1 (....);
create index .... on TAB1 ...
That is I want to take a parent node's attribute down to a child
node level. How can I
do this? what XSL rule should look like?
Thanks for any lead.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|