[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: ancestor/subsequent descendant test, problem resta

Subject: RE: ancestor/subsequent descendant test, problem restated
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Mon, 30 Mar 2009 03:26:29 +1300
RE:  ancestor/subsequent descendant test
Hi Ken

The stylesheet you wrote has identified a problem in the simple example;
unfortunately my simple example evidently isn't sufficiently true to life,
because it didn't pick up hanging content in a real example.

I really appreciate that you have continued offering help here and I'm sorry
if it looks as though I keep changing the terms of the problem; I'm not,
honest!

Here follows a tree extracted from a real file which really has a problem.
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.

====

cat 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/>
								</section>
							</included>
							<included
srcfile="abc_web_grp_add.xml">
								<section>
	
<section/>
	
<section/>
								</section>
							</included>
							<included
srcfile="abc_web_grp_nest.xml">
								<section>
	
<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>

====

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.

====

cat 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']">
		<xsl:variable name="probf"
select="ancestor::included[1]/@srcfile" />
Problem section found in: <xsl:value-of select="$probf"/>
	</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

====

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.

Thanks, trying not to be demanding
Trevor

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.