|
-
Jun 12th, 2008, 04:27 PM
#1
Thread Starter
Hyperactive Member
XQuery with Nested Return
Hello I was wondering if someone could help me with this awfully frustrating conundrum. What I am trying to do is have the return return both a single value and the results of another xquery. The tricky part is that I do not want to return the content as XML but rather in plain text.*
My specific case is that I want to find every enumeration in an XSD, print out the name of the datatype, and underneath it the list of all its possible values.
Now this works:
Code:
declare namespace xsd = "http://www.w3.org/2001/XMLSchema";
declare variable $url := ".....";
declare variable $src := doc($url);
declare variable $nl := codepoints-to-string(10);
for $type in $src//xsd:simpleType[.//xsd:enumeration]
let $typeName := string($type/@name)
return <x>{concat($nl,"===",$typeName,"===")}{
for $value in $type/xsd:restriction/xsd:enumeration/@value
let $enumName := string($value)
return concat($nl,"* ",$enumName)
}</x>
But if I try to remove the <x></x> it fails. I've tried every possible combination of {} and , imaginable. I also tried passing the second XQuery as an argument to concat() but that didn't work either. While I could do some post processing but since I'd like to be able to rely on XQuery in the future I want how to learn to do this the proper way.
I tried Googling but all examples show only the XML version and I'm certain there must be a way to do this for plain text
* Technically I'm trying to output it in MediaWiki syntax.
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|