Re: check if nodes match xpath expression
Christian, Thank you for your high appreciation of this "great little tool". :o)) > > <xsl:if test="count(. | $SelectedNodes) = count($SelectedNodes) "> > Thanks very much for that trick... This should be in the XSLT FAQ! The above is not a trick at all -- it is such universal law of set theory and logic, that it's actually an axiom -- one of the pieces of knowledge that do not have to be proven, because they are at the base and start of everything. > However, the stylesheet we need must not depend on microsoft technology > since we have to use it in a variety of operating systems, so the > visualiser is out of the question. I think you're quite mistaken here. The XPath Visualiser does not rely significantly on proprietary technologies at all. Here are the facts: 1. The html output generated is displayed in Netscape (4.7) without problem -- apart from the minor issue that nodes cannot be collapsed, the formating, hilighting and syntax colouring is displayed perfectly OK. You can try this for yourself -- copy the source of the lower frame and save it to a file -- then display it with Netscape. 2. The stylesheet that does 100% of the processing (although heavily based on the original MS defaultss.xsl) is pure XSLT and could easily be used with another XSLT processor. The only extension function that is used is to get the "xml" property of a node. Something like this will be necessary regardless of which XSLT processor is being used. The reason is that it is not possible without extensions to determine the fact (of) and exact location of a namespace definition. Consider the fact that IE is a browser with one of the best XML/XSL built-in support and also used by 70-80% of all users, and you could understand why many developers do not believe in universal solutions and do not feel enough masochistic to try to implement such. Cheers, Dimitre Novatchev. P.S. About colours -- I haven't changed the colour scheme used in the IE defaultss.xsl and I like it. ------------------------------------- Christian Nentwich wrote: > I'd greatly appreciate receiving any comments reflecting your > experience with the XPath Visualiser. > <xsl:if test="count(. | $SelectedNodes) = count($SelectedNodes) "> Thanks very much for that trick... This should be in the XSLT FAQ! The XPath Visualiser is a great little tool. I have used it in talks for lightning introductions to XPath. I think it is particularly valuable as a teaching tool. However, the stylesheet we need must not depend on microsoft technology since we have to use it in a variety of operating systems, so the visualiser is out of the question. My summary: Great stuff, but only under windows. And also, I had to change the colours because the default ones killed me :) (Colour customisation wasn't that easy because, for example, it's not that easy to see from the documentation which class is the colour for the '+' character) -- "If anything can be linked, it will be linked." - xlinkit Christian Nentwich Dept. of Computer Science, University College London +44 (0)20 7679 7190 - http://www.cs.ucl.ac.uk/staff/c.nentwich __________________________________________________ Do You Yahoo!? Yahoo! Shopping - Thousands of Stores. Millions of Products. http://shopping.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format