|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: how to match the absence of a particular attribute
how can I test the presence of a particular attribute of a node in an "if" or "choose" tag? I need to drive the behavior of the translation in two different ways, if an attribute exists or not. Given: <A> <B a="a">hello2</B> <B a="a" b="b">hello3</B> <B>hello1</B> <B b="b">hello4</B> </A> If you want only those Bs which have a or b attributes, the following witll pick them out: <xsl:template match="A/B[@a or @b]"> <xsl:copy-of select="."/> </xsl:template> If you want only those Bs which have at least one attribute, the expression would be select="A/B[@*]". If you want only those Bs which have no "a" attribute, the expression would be select="A/B[not(@a)]", and so forth. I suppose the key point is the capability to match the absence of an attribute, but I have found no way to do this. As advice I should follow myself, if you haven't formally read any books on XML/XSLT, doing so would be of huge benefit. Regards, --A _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
|
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








