Re: [xsl] Want to process child and decendent nodes the same way as parent node but can only process children

Subject: Re: [xsl] Want to process child and decendent nodes the same way as parent node but can only process children
From: "Graydon graydon@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 16 Dec 2014 02:47:57 -0000
On Tue, Dec 16, 2014 at 12:18:11AM -0000, Jason Davis nosaj3@xxxxxxxxx scripsit:
> I am currently trying to process multiple files for specific nodes and
> collect them in a meaningful way to demonstrate the parent-child
> relationship but I'm having trouble getting past the first level of
> children.

[snip]

> And believe me, I'm sure there are better ways to accomplish what I am
> attempting. So, any insights or suggestions for improvement, better
> efficiency, etc. are greatly appreciated. I'm pretty much an amateur
> with XSLT. So, please let me know if I am missing anything.

This sounds like a DITA map-merge sort of problem.  The trick with
those is to recognize that your stylesheet will happily consume multiple
source documents, so you start at the "topmost" document and when you
get to the child documents you use

<apply-templates select="document(@href)"/> 

or similar to process the interesting child document referenced by the
@href  Then you make sure the templates -- maybe using modes -- are set
up to match only what you want in the result document.

In this application, you probably have to set up templates to ignore
what you don't want, but the trick is to move the context node into the
child documents as necessary.  It's not an initially natural way to
think but does get easier with practise.

This is much, much easier than trying to construct references of
references to arbitrary depth!

-- Graydon

Current Thread