xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Complex Condition problem with Attributes


Subject: Re: [xsl] Complex Condition problem with Attributes
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
Date: Thu, 15 Sep 2005 13:40:28 +0100

From: David Carlisle <davidc@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Complex Condition problem with Attributes
Date: Thu, 15 Sep 2005 13:32:06 +0100

> It failes at the position @. But why?

you can't just put an axis (or an abreviated  axis such as @) straight
after a predicate: you have to separate steps in an XPath expression
with / so its
...] / @...
not
...]  @...

so
<xsl:when test="//*[contains(name(),'DebtManagement') and
(//*[contains(name(),'DebtManagement')]/@action='add' or
//*[contains(name(),'DebtManagement')]/@action='delete')">

is legal but doesn't test what you want to test.

(do you really want to use // it's very expensive operation: searching
the whole document to arbitrary depth)

"//*[contains(name(),'DebtManagement')
finds the elements you want but then (I think) you want to know if
_those_ elements have an add or delete action, but your test just
searches the entire document again (twice) finding the same eleemnts
each time.

I think you want

//*[contains(name(),'DebtManagement')[@action='add' or @action='delete']

But if you can use something other than // it is likely to be more
efficient. Or you could use a key.

David


I think you missed off a ].


//*[contains(name(),'DebtManagement')][@action='add' or @action='delete']


Joe



Current Thread
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor