When is “|” not the same as “union”? The XPath specification says:
"The union and | operators are equivalent. They take two node sequences as operands and return a sequence containing all the nodes that occur in either of the operands." http://www.w3.org/TR/xpath20/#doc-xpath-UnionExpr The applet runs on my mac. Try to update Java and then add “http://www.w3c.org” as a trusted site in “System Preferences” > “Java” > “Security" Josh On Nov 11, 2014, at 9:51 AM, Philip Fennell <[email protected]> wrote: > Hello Joe. > > > Did you see xqx:unionOp? > > The xqx:unionOp for (a | b) as XQueryX: > > <xqx:unionOp> > <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:unionOp> > > gives me: > > (child::a union child::b) > > when transformed to XQuery using the supplied XSLT transform(s). > > union is part of intersect and except group of instructions, and that's not > the same as the pipe operator in a path expression, and it's that that I'm > trying to serialise as an XPath (XQuery) expression. > > > > There is an XQueryX translator here: > > http://www.w3.org/2007/01/applets/xqueryApplet.html > > I cannot get the applet to run in any of my browsers on my Mac. Despite some > hacking around I cannot get the permissions to allow the Applet to run. > > > Thanks for the response. > > Regards > > Philip > > > On 11 Nov 2014, at 17:37, Josh Spiegel <[email protected]> > wrote: > >> 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
_______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
