I can't think of one.  Looking at the syntax of the typeswitch expression:

http://www.w3.org/TR/xquery/#id-typeswitch

the case clause takes a SequenceType, which is specifically defined in the spec 
as one of several KindTests.

-Danny

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Ignacio Tripodi
Sent: Tuesday, September 10, 2013 3:35 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Sequence-type matching on element AND 
attribute

Yes, that is the current workaround I have. I was wondering if there was a 
"cleaner" way to put it all in a single sequence-type matching expression. 

Thanks, though!

-i


On Sep 10, 2013, at 4:33 PM, Danny Sokolsky <[email protected]> 
wrote:

> How about something like:
> 
> typeswitch ($x)
>  case element (foo) return if ($x/@bar) then do-something() else () 
> ....
> 
> -Danny
> 
> 
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Ignacio 
> Tripodi
> Sent: Tuesday, September 10, 2013 3:29 PM
> To: [email protected]
> Subject: [MarkLogic Dev General] Sequence-type matching on element AND 
> attribute
> 
> Hi team,
> 
> Is it possible to match, on a typeswitch expression, a particular element and 
> attribute name simultaneously? I know it's possible to match on either case:
> 
> typeswitch ($some_node)
>   case element(foo) return
>      (: do something :)
>   case attribute(bar) return
>      (: do something else :)
>   default return
>      (: fallback :)
> 
> ... but is there a way to match a case on specifically the node <foo 
> bar="test1">test2</foo>?
> 
> Thanks for any ideas you may provide!
> 
> -i
> 
> _______________________________________________
> 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