Thanks Doug too ----- Original Message ----- From: "Douglass A Glidden" <douglass.a.glid...@boeing.com> To: general@developer.marklogic.com Sent: Wednesday, October 7, 2009 1:19:22 PM GMT -05:00 US/Canada Eastern Subject: RE: [MarkLogic Dev General] Can someone explain how I can get thefollowing info
Corrections inline below. There might be additional errors I missed. Doug Glidden Software Engineer The Boeing Company douglass.a.glid...@boeing.com From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com] On Behalf Of ma...@comcast.net Sent: Wednesday, October 07, 2009 12:43 To: General Mark Logic Developer Discussion Subject: [MarkLogic Dev General] Can someone explain how I can get thefollowing info I have part of an xml document below I run the following xquery for $question in doc()//Section/PrintQuestion let $questionid := $question/@id let $questions := $question/*/TextFragment Here's the problem: The line above should be "let $questions := $question//TextFragment". To understand the difference, it's helpful to use full, rather than abbreviated, syntax for the XPath: Your XPath expression is equivalent to: $question/child::*/child::TextFragment My corrected version is quite different: $question/descendant::TextFragment Always remember that a single slash that is not followed by an axis selector selects the child axis. return (<div>{string($questionid)}:{for $question in $questions return string($questions/@value)}</div>) There are two problems in this line: First, the TextFragment element does not appear to have a value attribute, and second, for each iteration of the for expression, you're returning the value of all of the questions. What you probably intended was "... return string($question/value()) ...". I can get the PrintQuestionAttribute, but how do I get the TextFragment Question under it? that reads "Randall will spin the spinner twice and add the numbers. What is the probability that he will get a sum that is greater than 5? " -- Thanks, Mike <PrintQuestion id="P620_S4940_0" type="pickOne"> <Standards> <Standard value="" /> </Standards> <References> <PassageRef id="" /> </References> <content contentID=""> <multichoice> <max_score>1</max_score> <question cssClass="" cssStyle=""> <Passage> <Paragraph> <TextFragment><![CDATA[Randall will spin the spinner twice and add the numbers. What is the probability that he will get a sum that is greater than 5?]]></TextFragment> </Paragraph> <Paragraph> <TextFragment type="graphic"></TextFragment> </Paragraph> </Passage> </question> _______________________________________________ General mailing list General@developer.marklogic.com http://xqzone.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com http://xqzone.com/mailman/listinfo/general