[Home] [By Thread] [By Date] [Recent Entries]
Mark Wilson wrote:
In an XML file used to generate a cumulative index to a journal, I have a number of similar citations, one of which sometimes needs to be removed from the file. Here is a stylesheet that tries to implement your rules as far as I have understood them: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:data="http://example.com/2009/data" exclude-result-prefixes="data" version="1.0"> <xsl:output method="xml"/> <data:data>
<Removals>
<Citation>Stamp Designers</Citation>
<Citation>Stamp Engravers</Citation>
</Removals>
</data:data> <xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template><xsl:template match="Subject[Heading = preceding-sibling::Subject[Heading = document('')/xsl:stylesheet/data:data/Removals/Citation]/SubDiv1]"/> </xsl:stylesheet> It is simply the identity transformation plus one template suppressing the copying of any Subject elements for which there is a preceding Subject element where the Heading is in the Removals list and where the preceding SubDiv1 is equal to the Heading. -- Martin Honnen http://JavaScript.FAQTs.com/
|

Cart



