Subject: Re: [xsl] Schema Exploration... From: "Mark R. Diggory" <mdiggory@xxxxxxxxxxxxxxxxx> Date: Sat, 20 Apr 2002 22:43:10 -0400 |
Ok, yes, I took this approach and defined a key like yours only with the match selection I got from Wendell.
Having a canonical representation, in particular with groups and derivations resolved (or ignored), it becomes easier to create the key. You can create a key that combines the name that you're looking for with the element (or complex type) in which it's contained. For example if you're adopting a "Russian Doll" style, where all complex types are anonymous and elements are all nested inside each other, you can use the following:
<xsl:key name="elements-by-parent-element" match="xs:element//xs:element" use="concat(ancestor::xs:element[1]/@name, '//' (@name | @ref))" />
So I was try something like this, but I can't get the syntax right: <xsl:variable name="my_snode" select="($parent_snode/descendant::xs:element/*[ancestor::xs:element[@name=$parent_snode/@name]][1] )[@name=$node_name or @ref=$node_name]"/>
I have a good example going now with this approach. It works very well for the schema I've been working with. Here's a demo site (Don't expect it will stay there forever.)
Each xs:element that occurs within another xs:element is indexed by a combination of its closest ancestor xs:element's name and its own name or ref attribute. For example, to find all the elements called 'foo' nested inside elements called 'bar', you could use:
key('elements-by-parent-element', 'bar//foo')
gulp
(The other thing that you'll have to tackle some point in the future
is namespace resolution of the 'ref' attributes.)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Schema Exploration..., Jeni Tennison | Thread | [xsl] Comparing an attribute value , Manny Parasirakis |
RE: [xsl] Re: RE: What is the corre, Oleg Tkachenko | Date | [xsl] keys and Xpath, Ahmad J Reeves |
Month |