Re: XSL problem

Subject: Re: XSL problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 2 Aug 1999 17:53:30 +0100 (BST)
]  I have an structure that looks like the following:

] <hr><p><b> Periodical Subject </b></p></hr>
] <i> Peridocal Subject Desc <i>

hr shouldn't have content, and i should close, so assuming that
is
<hr/><p><b> Periodical Subject </b></p>
<i> Peridocal Subject Desc </i>

and you wrap a list of such things up in a <doc> element
then probably this is what you want:

It says for every table inside the doc element, process every row except
the first into a periodical list.

then the second template says what to do with a row.

David



<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";
  indent-result="yes">


<xsl:template match="doc">
<periodical-list>
  <xsl:apply-templates select="table/tr[position() &gt; 1]"/>
</periodical-list>
</xsl:template>

<xsl:template match="tr">
  <periodical>
    <subject><xsl:apply-templates select=
         "../preceding-sibling::p/b[1]"/></subject>
    <desc><xsl:apply-templates select=
         "../preceding-sibling::i[1]"/></desc>
    <title><xsl:apply-templates select=
         "td[1]"/></title>
    <author><xsl:apply-templates select=
         "td[2]"/></author>
    <length><xsl:apply-templates select=
         "td[3]"/></length>
  </periodical>
</xsl:template>


</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread