xsl-list
[Top] [All Lists]

Re: Re: Comparing two xml documents

2003-03-12 17:03:27
Sir Pickaxe,

At 05:07 PM 3/12/2003, you wrote:
I have a further question, though:

What is the differenct between:
<xsl:template match="*">

This matches any element node, since elements are the "primary node type" of the axis.

The axis here is child:: (for those just learning XPath abbreviations).

and

<xsl:template match="node()">

Again the axis is child::, but the pattern matches any node type, not just elements. So child PIs and comments are matched.

I have looked at the id transformation that has come up a couple of times the last few days and it says: match="@*|node()" where I presume the @* is for all attributes (am I wrong in this)?

This is correct. You don't get attributes on the child:: axis; you have to select (and match) them on the attribute:: axis.

(As has been remarked more than once on this list and elsewhere, attributes are not the children of their parents. They know where their parents live, but they are not invited for the holidays. In genealogies they appear as embarrassing marginalia.)

When I am in the context of an xml file that has been "included" by the document function, how do I compare with elements in my source xml document? Or should I "include" them both in my xsl stylesheet transforming a dummy source xml?

What do you mean, "compare"?

In either case, you can bind node sets to variables, and the bindings stay constant (as long as in scope) even if you change your context to another document (another Base URI). Does this help?

Cheers,
Wendell


___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
    "Thus I make my own use of the telegraph, without consulting
     the directors, like the sparrows, which I perceive use it
     extensively for a perch." -- Thoreau


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list