|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] parse form data to XMLMartin Probst mail at martin-probst.comWed Sep 9 02:06:41 PDT 2009
> {for $parsed-query-term in $parsed-data
> let $parse-query-value := substring-after($parsed-query-term,"=")
> return <row attr="{???}">{xmldb:decode($parse-query-value)}</row>
> }
What about
for $parsed-query-term in $parsed-data
let $parse-query-value := substring-after($parsed-query-term,"=")
let $parameter-name := substring-before($parsed-query-term,
concat("=", $parse-query-value))
return <row attr="{$parameter-name}">{xmldb:decode($parse-query-value)}</row>
Alternatively you can simply split again:
for $parsed-query-term in $parsed-data
let $kv := tokenize($parsed-query-term, '=')
let $key := $kv[1]
let $value := string-join($kv[position()>1],'=')
return <row attr="{$key}">{xmldb:decode($value)}</row>
As the value might contain '=' (I think, or does that need to be
percent encoded?), $kv might contain multiple value parts, so the
string-join is necessary to glue them together again.
Martin
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






