Yes, or explicitly take the string value:

xdmp:describe(
  <div xmlns="http://www.w3.org/1999/xhtml";>{
  attribute class { 'foo bar' } }</div>/@class/string())
=>
"foo bar"

So //div[contains(@class/string(), "facet")] should work.

-- Mike

On 27 Feb 2013, at 14:36 , Jakob Fix <[email protected]> wrote:

> Ah ha! So if I'd be able to pretend the XHTML is"just XML", then this 
> should/could be considered/casted as a string?
> 
> cheers,
> Jakob.
> 
> 
> On Wed, Feb 27, 2013 at 10:37 PM, Michael Blakeley <[email protected]> wrote:
> It's because @class in xhtml is NMTOKENS, tokenized by whitespace. So 
> atomization yields (xs:NMTOKEN('mainPane', xs:NMTOKEN('clearfix')) rather 
> than xs:string('mainPane clearfix').
> 
> xdmp:describe(
>   <div xmlns="http://www.w3.org/1999/xhtml";>{
>   attribute class { 'foo bar' } }</div>/@class/data(.))
> =>
> (xs:NMTOKEN("foo"), xs:NMTOKEN("bar"))
> 
> -- Mike
> 
> On 27 Feb 2013, at 13:07 , Jakob Fix <[email protected]> wrote:
> 
> > Hi,
> >
> > I am probably daft here, but I'm getting an error for the following 
> > expression which I'm trying to apply to your typical Bootstrap-based HTML 
> > page:
> >
> > //div[contains(@class, "facet")]
> >
> > The error I'm getting is the following:
> >
> > [1.0-ml] XDMP-ARGTYPE: (err:XPTY0004) fn:contains(attribute{fn:QName("", 
> > "class")}{"mainPane clearfix"}, "facet") -- arg1 is not of type xs:string?
> >
> > This expression works elsewhere, but MarkLogic returns this error. I'm 
> > stumped ... Oh, I've upgraded to 6.0-2.3.  Thanks as ever!
> >
> > cheers,
> > Jakob.
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

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

Reply via email to