Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: another XSLT problem >Thread Next - Re: another XSLT problem Re: another XSLT problemTo: NULL Date: 9/6/2005 12:01:00 AM Peter Flynn wrote: > > <xsl:variable name="wri" > > select="count(items/item[(not(@doc = 'no') and @iname != > > starts-with(@iname,'dr')) and > > (not(@doc = 'no') and @iname != starts-with(@iname,'hr')) and > > (not(@doc = 'no') and @iname != starts-with(@iname,'usr')) and > > (not(@doc = 'no') and @iname != starts-with(@iname,'szr')) and > > (not(@doc = 'no') and @iname != starts-with(@iname,'ulr')) and > > (not(@doc = 'no') and @iname != starts-with(@iname,'ipr')) and > > (not(@doc = 'no') and @iname != starts-with(@iname,'br')) and > > (not(@doc = 'no') and @iname != starts-with(@iname,'ucr'))])"/> > > I'm not clear what this is trying to achieve. @iname is an attribute: > testing its inequality against a boolean like starts-with will probably > have unexpected effects, depending on whether the attribute is present > or not. If present, and starting with 'hr', then the first test should > always evaluate false. Here's what this achieves. This XPath finds all the writable <item> elements for me, because I can identify them when the iname attribute does NOT start with one of the read-only strings (hr, usr, ulr, etc.). If you are questioning the syntax of saying "@iname != starts-with(@iname,...)" instead of just "!= starts-with(@iname,...)", I did it that way because it seemed I had to or it didn't work. When I remove the "@iname !=", I get the error "Unexpected token != in expression" and it stops the transform. (I'm using Saxon at the command line.) I also tried putting the expression in parentheses like (!= starts-with(@iname,...)), and the same error occurred. It only worked when I put "@iname != starts-with(@iname,...)". At this point I think I will just take the money and run. I can count on there always being an iname attribute. Thanks again, Mark | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
