This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: removing nesting in data structure
- From: Mike Brown <mike at skew dot org>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 20 May 2002 14:01:24 -0600 (MDT)
- Subject: Re: [xsl] removing nesting in data structure
- Reply-to: xsl-list at lists dot mulberrytech dot com
Andrew Welch wrote:
> Ive found a problem already... for some reason it applies subpara3
> twice. Why is this?
<xsl:apply-templates
select="*[not(subpara1)][not(subpara2)][not(subpara3)]"/>
In English, you're saying "Of all the element node children of
the current node, I want just those that do not have subpara1
children..." and so on.
You wanted something more like
*[not(local-name()='subpara1' or local-name()='subpara2')]
or
*[not(starts-with(local-name(),'subpara')]
I posted a better example where you just go ahead and select all
children for processing, and have templates matching the ones you
expect to encounter.
Also, I question the wisdom of having distinct element types 'subpara1',
'subpara2', 'subpara3', when you could just have nested 'subpara' elements,
eliminating the need for numbering. Even then, if the content model of subpara
is (para,subpara?), then I'd be inclined to change the names to something like
paragroup & paracontent or something less confusing. ;)
- Mike
____________________________________________________________________________
mike j. brown | xml/xslt: http://skew.org/xml/
denver/boulder, colorado, usa | resume: http://skew.org/~mike/resume/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list