From: Alexander K. <kw...@ah...> - 2003-01-24 07:48:33
|
Franck Arnaud wrote: ... > <books xmlns="http://books" xmlns:html="http://zork"> > <book> > <title>Blah</title> > <review html:style="font: sans-serif">Good book about blah</review> > </book> > <book> > <title>Foo</title> > <review style='humorous'>foo: bar!</review> > <backcover><html:p style="font:serif">Foo is a serious matter [...] > </book> > </bookstore> > > How do I write two distinct rules that match 'style' from the > HTML vocabulary and style from the 'books' vocabulary? The XSLT > (or rather Xpath) semantics seem pretty inconvenient to me. According to http://www.jclark.com/xml/xmlns.htm this XML could be mapped (only interesting parts are left) to the following imaginary syntax: <{http://books}review {http://zork}style="font: sans-serif">... <{http://zork}p style="font:serif">... Then the following rules can be used to match the attributes: <xsl:template match="@html:style">... -- for the first "style" attribute <xsl:template match="@style">... -- for the second "style" attribute because the expanded name is used to locate the nodes according to http://www.w3.org/TR/xpath#section-Location-Steps As to Void and non-Void namespace for the attributes the XPath Recommendation 1.0 tells the following: The namespace URI of the attribute's name will be null if the QName of the attribute does not have a prefix. (see http://www.w3.org/TR/xpath#attribute-nodes). Alexander Kogtenkov Object Tools, Moscow |