Here is a test case for the issue I'm looking at:

xquery version "1.0-ml";
declare namespace xh = "http://www.w3.org/1999/xhtml";;

let $test :=
<table xmlns="http://www.w3.org/1999/xhtml";>
    <tr class=""><td>xxx</td></tr>
    <tr class="ms-alternating"><td>aaa</td></tr>
    <tr class=""><td>xxx</td></tr>
    <tr class="ms-alternating"><td>bbb</td></tr>
    <tr class=""><td>xxx</td></tr>
</table>

let $result := <result>{$test/xh:tr}</result>

let $new-test :=
    <table>
    {
    for $r in $test//xh:tr
    let $row := <tr class="{ $r/@class }">{ $r/node() }</tr>
    return $row
    }
    </table>

let $new-result := 
<new-result>{$new-test/t...@class!="ms-alternating"]}</new-result>

return <results>{$result, $new-result}</results>

  As shown above, this query works.  It returns all the rows in the <result> 
element, and only the rows with an empty class attribute in the <new-result> 
element.  The test data is a simplified piece of a file I got from the web and 
cleaned up with tidy().

  What I would like to do is be able to apply the [...@class!="ms-alternating"] 
selector to the original $test variable, but if I try this I get an error 
saying: [1.0-ml] XDMP-LEXVAL: xs:NMTOKEN("") -- Invalid lexical value "".  The 
best I can figure out is that the xhtml namespace defines a class attribute to 
have an xs:NMTOKEN, and therefore trying to operate on an attribute that says 
'class=""' fails.  It seems like either there should be some way to process 
this data or that tidy() should strip out any empty class attributes.

  Any suggestions?

  Peter


 NOTICE: This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy all 
copies of the original message.


_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to