Did you see xqx:unionOp? There is an XQueryX translator here: http://www.w3.org/2007/01/applets/xqueryApplet.html
You can use it to convert "(a | b | c)” to XQueryX. Josh On Nov 11, 2014, at 6:53 AM, Philip Fennell <[email protected]> wrote: > Hello, > > I'm doing some work with XQueryX and it's not obvious how you create a union > of path expressions. Given the example of: > > (a | b | c) > > which generates the following parse tree, using the java XQuery parser app,: > > |QueryList > | Module > | MainModule > | Prolog > | QueryBody > | Expr > | PathExpr > | ParenthesizedExpr > | Expr > | UnionExpr | > | UnionExpr | > | PathExpr > | StepExpr > | AbbrevForwardStep > | NodeTest > | NameTest > | QName a > | PathExpr > | StepExpr > | AbbrevForwardStep > | NodeTest > | NameTest > | QName b > | PathExpr > | StepExpr > | AbbrevForwardStep > | NodeTest > | NameTest > | QName c > > there doesn't seem to be anything in XQueryX that actually allows you to > construct a UnionExpr. > > I've taken to extending XQueryX with a xqx:unionExpr element but seeing the > way the parse's output (see above) appears to treat it like a > binaryOperatorExpr, with first and second operands, I thought I'd do the > following: > > <xqx:unionExpr> > <xqx:firstOperand> > <xqx:unionExpr> > <xqx:firstOperand> > <xqx:pathExpr> > <xqx:stepExpr> > <xqx:xpathAxis>child</xqx:xpathAxis> > <xqx:nameTest>a</xqx:nameTest> > </xqx:stepExpr> > </xqx:pathExpr> > </xqx:firstOperand> > <xqx:secondOperand> > <xqx:pathExpr> > <xqx:stepExpr> > <xqx:xpathAxis>child</xqx:xpathAxis> > <xqx:nameTest>b</xqx:nameTest> > </xqx:stepExpr> > </xqx:pathExpr> > </xqx:secondOperand> > </xqx:unionExpr> > </xqx:firstOperand> > <xqx:secondOperand> > <xqx:pathExpr> > <xqx:stepExpr> > <xqx:xpathAxis>child</xqx:xpathAxis> > <xqx:nameTest>c</xqx:nameTest> > </xqx:stepExpr> > </xqx:pathExpr> > </xqx:secondOperand> > </xqx:unionExpr> > > which, with a tweak to the XQueryX to XQuery transform gives me this: > > child::a | child::b | child::c > > > Would those who have a more intimate knowledge of the XQuery syntax tree and > how you would go about implementing this let me know if what I've done is any > good. > > All feedback, good or bad, would be much appreciated. > > > Many thanks in advance. > > > Philip > > > > > > > _______________________________________________ > [email protected] > http://x-query.com/mailman/listinfo/talk
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
