RE: [xsl] XML to Table

Subject: RE: [xsl] XML to Table
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Fri, 16 Apr 2004 20:12:57 +0200
> -----Original Message-----
> From: Veronica Sanchez [mailto:vsguiseris@xxxxxxxxxxx]
>

Hi,

> 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.
>

Try this:

<xsl:stylesheet ..>

<xsl:template match="/">
  <xsl:copy>
    <xsl:apply-templates select="ROWSET/ROW" />
  </xsl:copy>
</xsl:template>

<xsl:template match="ROW">
  <xsl:apply-templates select="../../DETAIL">
    <xsl:with-param name="prow" select="current()/@num">
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="DETAIL">
  <xsl:param name="prow" select="0" />

  <xsl:for-each select="COLUMN">
    <xsl:element name="{current()/@name}">
       <xsl:value-of select="/XML/ROWSET/ROW[$prow]/*[
              name()=current()/@name]" />
    </xsl:element>
  </xsl:for-each>
</xsl:template>

> I can change the structure of <DETAIL></DETAIL> if it would be necessary.

Nope. I don't think that's necessary. The trick in the above is that when
the xsl:value-of returns nothing, an empty node is created, so there is no
need for the xsl:choose.


>
> 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

Current Thread