Hi, i would like create a table from a xml with a format like this:
<XML>
<ROWSET>
<ROW num="1">
<A>asdf</A>
<B>asd</B>
<C>asdf</C>
<D>asdf</D>
<E>ad</E>
...
</ROW>
<ROW num="2">
<A>asdf</A>
<B>asdf</B>
<D>asdf</D>
<E>asdf</E>
...
</ROW>
<ROW num="3">
...
</ROW>
...
</ROWSET>
<DETAIL>
<COLUM nom="A" class="a" ord="1"/>
<COLUM nom="B" class="b" ord="2"/>
<COLUM nom="C" class="c" ord="3"/>
</DETAIL>
</XML>
I'm using a xsl like this to keep the fields that i need
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:key name="a" match="//DETALLE/CAMPO" use="@nom"/>
<xsl:template match="XML">
<XML>
<ROWSET>
<xsl:for-each select="ROWSET/ROW">
<xsl:variable name="row" select="@num"/>
<ROW>
<xsl:attribute name="num"><xsl:value-of
select="$row"/></xsl:attribute>
<xsl:for-each select="//DETAIL/COLUMN">
<xsl:variable name="column" select="@nom"/>
<xsl:choose>
<xsl:when test="//ROW[@num = $row]/*[name() = $column]">
<xsl:copy-of select="//ROW[@num = $row]/*[name() =
$column]"/>
</xsl:when>
<xsl:otherwise>
<!-- To create empty node that is absent with his label,
ex. <C></C> at the second node -->
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</ROW>
</xsl:for-each>
</ROWSET>
</XML>
</xsl:template>
</xsl:stylesheet>
Finally I use another xsl to give format of table.
The question is that i have problems with the first step, the xsl is too
slow and i can't create the node that doesn't exist in the row and that I
want to visualize.
I can change the structure of <DETAIL></DETAIL> if it would be necessary.
If it's possible i would prefer the use of one only xml. can I do it?
Thanks to all.
_________________________________________________________________
Correos mas divertidos con fotos y textos incrembles en MSN 8. Pruibalo
gratis dos meses. http://join.msn.com/?pgmarket=es-es&XAPID=45&DI=1055