David Blickstein wrote:
> I'm dealing with an XML Schema that uses Schema keys. Specifically the
> Schema takes advantage of the ability to define the keys to be specific to a
> particular scope, which allows duplication between scopes.
>
> That is I can have a schema like this:
>
> <Company Name="Nike">
> <Product Name="Sneaker"/>
> <Warehouse ProductStored="Sneaker"/>
> </Company>
> <Company Name="Asics">
> <Product Name="Sneaker"/>
> <Warehouse ProductStored="Sneaker"/>
> </Company>
>
> The key is the "Name" attribute of the "Product" tag and its scope is
> limited to the local "Company". And ProductStored is the keyref to that
> key. If the key were not scoped, "Sneaker" would be a duplicate but
> because it's scoped to the company, each reference isunambiguous.
>
> Now the question I have is... in XSLT, I want to use these scoped keys
> because I want to create hyperlinks from the Warehouse output to the
> Product.
XPath 1.0 and XSLT 1.0 do not have any W3C XML schema support, they
predate the XML schema specification by two years I think.
So there is nothing specific to dealing with such keys defined in a schema.
But of course XPath allows you to write expressions relative to a
certain node and that way if you process a <Company> element node you
can certainly look for
Product[@Name = following-sibling::Warehouse/@ProductStored]
And of course XSLT 1.0 has the <xsl:key> element to set up your own keys
for XSLT processing and then use the XSLT key function to lookup stuff.
--
Martin Honnen
http://JavaScript.FAQTs.com/