xsl-list
[Top] [All Lists]

Re: [xsl] document tree fragments

2008-10-12 08:13:03
G. Ken Holman wrote:

Is it true that you want *only* the filename of @filename to be added to @path, or do you want that portion of @filename that matches @path to be removed and if there are more directory steps they are to be included?

Gidday Ken,

Uhh, yep. Call it rdbms-think: I saw a whole lot of repetitions of the
path & decided it would be nicer in one place. You're right, though, I
may well have to branch the directory path with further sub-directories.

In XSLT 1.0 you will have to use extension functions to work with manipulated versions of the attributes. If you gave up on the @path attribute and only used @filename, then you don't need to resort to extensions and you can use:

  document(/docs/doc/@filename)

... to get a node set of the document nodes of all of the files. If you have to do any manipulation on each filename then you have to resort to using extension functions.

My project is intended to work with all recent-ish browsers. I earlier
had a play with exslt's set-distinct function, because that seemed like
a neat tool that I'd get a lot of use out of, but could only get it to
work with Firefox 3.0--i.e. MSIE 7 & Opera 9.5 & 9.52 both barfed. <shrug>

No ... if you open five files you end up with a node set of five nodes.

[snip]

Correct ... trees are independent of each other. The processor keeps an implicit order (of its own determination) *between* trees, but there are no axes that span across trees.

You need to do grouping cross multiple trees which is done using the variable-based method.

Since you haven't posted examples, I'll sketch out what you need without testing it:

[snip]

Do I need to wrap the sequence of tree fragments in my $theWines variable inside a node?

You could but then you'd have to use an extension (the same node set extension) to access the resulting tree ... the above variable method works without extensions and across multiple trees in XSLT 1.0.

Chapter 9 of my PDF book and XSLT video goes into the three methods of grouping in XSLT 1.0 (axis, key and variable) and when to use each (and how XSLT 2.0 is so very superior).

I hope this helps.

Enormously, thanks very much for your snippet & very clear & useful
explanations.

Cheers!

Joe



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>