|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [XPath] matching elements which satisfy a specific
> I this a full equivalent? not on its own, I did * not +. variablelist[varlistentry and *[(position()=1 and self::title) or self::varlistentry]]> is one way of fixing it. But it's probably easier to leave that as it is and have a separate <xsl:template match="variablelist[title and not(varlistentry)]" priority="2"> to pick up the edge case. I find it's rare to ever need this kind of test though. If your input may include <variablelist> <title></title> </variablelist> and <variablelist> <title></title> <varlistentry/> </variablelist> how do you want them to be processed? If the first is an error you can arrange to dtd validate before transforming in which case such fragments will never get as far as XSLt so you don't need to check for them in the pattern. If validation is not an option it's often simpler to match on the simpler * case but then have <xsl:if test="not(varlistentry)">... Do you really have a case where you want to accept both these things but teh reulting output is so different that you don't want to share a template for the two cases? David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ 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
|

Cart








