RE: [xsl] Keys working on nodeset?

Subject: RE: [xsl] Keys working on nodeset?
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Mon, 25 Jul 2005 16:31:37 +0100
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] Keys working on nodeset?
Date: Mon, 25 Jul 2005 16:25:41 +0100


> Hi Andrew, > > Thanks for the response. I had not thought on extension > functions. If keys do not work on the nodeset, then I will > pursue this.

Keys definitely work on nodesets - it's just passing a nodeset into a
transform is notoriously tricky... so if you are having problems it
could be that you are passing something else into the transform that you
think is a nodeset.  At least if you pass a string in and then use an
extension function such as parse to turn it into a nodeset you are
guaranteed that what gets returned is acceptable to the processor.

> If I understand correctly, the urlsolution will not work for
> me. The document will be transformed many times each time
> with different input. Both the document and the input are
> generated on the fly from a database, which is why I do not
> have url locations.

There are 3 ways I can think of to do this:

1- The way you are doing it now, pass the input xml in as a parameter

2- Use a custom URIResolver that intercepts a document() call and return
the input xml that way

3- Combine the two xml documents together before the transformation and
then the xslt only has to work on a single document.

Out of the 3, option 2 is the best but I'm not sure there's a .Net
equivalent of a custom URIResolver (which is in Java).

cheers
andrew

I can let you have a custom resolver I wrote for .NET if you need a head start. You need to override XmlResolver.

Joe

Current Thread