Subject: RE: [xsl] ancestor/subsequent descendant test, problem restated From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 30 Mar 2009 09:38:40 +0800 |
Here it is the section contained within the included "abc_config_file.xml" element, because this section will produce a separate result document, and section content both before and after it will go into the result document produced by the first section inside the included "abc.xml" element.
Because this generated file has stripped out all the content inside the sections, including the ids, I modified your XSL to use the srcfile of the nearest ancestral "included" element, which on reflection is probably how I would choose to report the problem to the authors anyway. ... <xsl:variable name="probf" select="ancestor::included[1]/@srcfile" /> Problem section found in: <xsl:value-of select="$probf"/>
I think the preceding-sibling test would work if I could somehow strip out any "included" elements in the tree before evaluating the "sibling" sections. Unfortunately I can't rely on there being zero, one, two, or any number of nested "included" elements complicating the [sibling/*-nephew/*-uncle] relationship.
T:\ftemp>type trevor.xml <?xml version="1.0" encoding="UTF-8"?> <document> <included srcfile="introduction.xml"> <section sig="Y"> <section/> </section> </included> <included srcfile="abc.xml"> <section sig="Y"> <included srcfile="abc_intro.xml"> <section/> </included> <included srcfile="abc_config.xml"> <section> <included srcfile="abc_config_file.xml"> <section sig="Y"> <section> <section>
<section/> </section> <section/> </section> </section> </included> <included srcfile="abc_config_reloc.xml"> <section> <section/> <section/> </section> </included> </section> </included> <included srcfile="abc_remove.xml"> <section/> </included> <included srcfile="abc_web.xml"> <section> <included srcfile="abc_web_grouping.xml"> <section> <included srcfile="abc_web_grp_intro.xml"> <section/> </included> <included srcfile="abc_web_grp_create.xml"> <section>
<section/> </section> </included> <included srcfile="abc_web_grp_add.xml"> <section>
<section/> </section> </included> <included srcfile="abc_web_grp_nest.xml"> <section>
<section/> </section> </included> </section> </included> <included srcfile="abc_motd.xml"> <section> <included srcfile="abc_motd_display.xml"> <section/> </included> <included srcfile="abc_motd_edit.xml"> <section/> </included> </section> </included> </section> </included> <included srcfile="abc_security.xml"> <section> <section> <section/> </section> </section> </included> </section> </included> </document>
Problem section found in: abc_config_reloc.xml 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')]"> <!--find the closest preceding section at the same section depth--> <xsl:if test="preceding::section[count(ancestor::section)= count(current()/ancestor::section)][1]/ @sig='Y'"> Problem section found in: <xsl:value-of select="ancestor::included[1]/@srcfile"/> </xsl:if> </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, Michael Ludwig |
Re: [xsl] Need help combing two ele, Fatbob | Date | Re: [xsl] Need help combing two ele, Syd Bauman |
Month |