[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Template rules vs. XQuery (was RE:"*NEVER* use for
Hi Evan, > <xsl:when test="count(.|../@*)=count(../@*)"> > <!-- built-in rule for attribute nodes --> > <!-- btw: someone please give me a better way to > test whether the current node is an attribute --> > <xsl:value-of select="."/> > </xsl:when> In this context, you could use: .. and not(self::node()) In fact the root node has already been filtered out, so you don't have to test whether this node has a parent. The other thing to be aware of is that this matches namespace nodes too. But if you're only dealing with a conversion from the matching template version to a named template version then you're fine because namespace nodes can't be matched on. > Is there anything that I'm missing here? Or is there anything that > could not be converted in such a way? xsl:apply-imports? - there's no equivalent for named templates. There isn't a programmatic way of supporting that because you can't know which next template is going to be processed without knowing what the source is going to be. I think you'd also start running into problems when you add support for parameters in named templates - you could add them to your applyTemplates template, but you'd have to take care of name clashes (with possibly different default values) in it. But that's a fairly minor issue - just requires a generate-id()-ed modifier on the name to make them unique. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.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
|