[Home] [By Thread] [By Date] [Recent Entries]
At 2009-03-28 15:07 +1300, Trevor Nicholls wrote:
Anongst other stuff my input documents contain sections, and sections can feature as descendants of other sections (either as children or as lower order descendants). Certain sections are marked with a particular attribute which I described as "significant". Then all you need is to report those sections without the @sig that follow those sections with the @sig because they will then be "hanging" by your definition. I hope this helps. . . . . . . . . Ken t:\ftemp>type trevor1.xml
<!-- F1 -->
<section>
<include>
<section>.A.</section>
<!-- F2 -->
<section sig="Y">
<section>.B.</section>
<include>
<section>.C.</section>
</include>
</section>
<!-- F3 -->
<section sig="Y">
<section>.D.</section>
</section>
</include>
</section>t:\ftemp>xslt trevor1.xml trevor.xsl t:\ftemp>type trevor2.xml
<!-- F1 -->
<section>
<include>
<section>.A.</section>
<!-- F2 -->
<section sig="Y">
<section>.B.</section>
<include>
<section>.C.</section>
</include>
</section>
<!-- F1 -->
<section>
<section>.D.</section>
</section>
</include>
</section>t:\ftemp>xslt trevor2.xml trevor.xsl Problem section:
t:\ftemp>type trevor.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"><xsl:output method="text"/> <xsl:template match="/">
<xsl:for-each select="//section[not(@sig='Y')]
[preceding-sibling::section/@sig='Y']">
Problem section: <xsl:value-of select="@id"/>
</xsl:for-each>
</xsl:template></xsl:stylesheet> t:\ftemp> -- XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|

Cart



