Subject: RE: [xsl] ancestor/subsequent descendant test, problem restated From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sat, 28 Mar 2009 07:34:38 +0100 |
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".
I think the key that I missed out is how this significance affects later processing of these documents: in one stylesheet which runs across these documents any sections with the significant attribute invoke a new result-document.
The condition which I am trying to detect is where there will be content "left over". I suppose you could think of it as a place where the tree model and the linear model are in conflict. ... This case is not OK, the .D. section region is left hanging when the F2 result document is completed and thus it goes back into F1.
All the sections have ids (which I've left out of the example) which can be used to report a problem.
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>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>
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: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>
-- 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] ancestor/subsequent desce, Trevor Nicholls | Thread | RE: [xsl] ancestor/subsequent desce, Trevor Nicholls |
RE: [xsl] ancestor/subsequent desce, Trevor Nicholls | Date | [xsl] substring after/substring bef, Joga Singh Rawat |
Month |