[Home] [By Thread] [By Date] [Recent Entries]
Trevor Nicholls schrieb:
My input documents are allowed to contain nested sections. An optional attribute marks out certain sections as significant. I want to detect a situation in which a section which contains a descendant significant section does not contain a subsequent INsignificant section (other than descendants of any significant sections).
Could this be it? The section .D. is OK because it is within a "significant section", but if the section it is wrapped in did not have the significant attribute set then I want to report it, because it is INsignificant and a descendant of a section which contains a prior significant section. Maybe the following does what you want, but I'm not sure. Michael Ludwig <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/">
<xsl:apply-templates select="*"/>
</xsl:template> <xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template> <xsl:template match="section[ not(@sig='Y') ]">
<xsl:copy>
<xsl:if test="
ancestor::section[1][not(@sig='Y')]
/
preceding-sibling::section[1][@sig='Y']">
<xsl:attribute name="INSIGNIFICANT">Y</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template></xsl:stylesheet>
|

Cart



