xsl-list
[Top] [All Lists]

Re: [xsl] Re-arranging an XML file

2009-01-13 08:45:49
Mike Stroud wrote:

Is there an easy way for an XSL rookie to transform  it to look more like this?

Here is an XSLT 1.0 stylesheet:

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="Catalog">
    <xsl:copy>
      <xsl:apply-templates select="cds/cd"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="cd">
    <xsl:copy>
      <xsl:copy-of select="title"/>
      <artist>
<xsl:value-of select="../../artists/artist[number = current()/number]/name"/>
      </artist>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>


--

        Martin Honnen
        http://JavaScript.FAQTs.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>