|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL problem
] 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() > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








