[xquery-talk] separating attribute name from its value

Martin Probst martin at x-hive.com
Fri Mar 3 10:35:25 PST 2006


You can construct nodes like this

...
return
  <attribute path="{ string-join($attr/ancestor-or-self::*/node-name(),
'/') }">
    { element attribute-name { fn:node-name($attr) } }
    { element attribute-value { fn:data($attr) } }
  </attribute>


On Thu, 2006-03-02 at 20:19 -0800, fatma helmy wrote:
> suppose i have the following xquery
> let $j := <book> 
> <author firstname='joe' lastname='carlon'>
> <author>
> </book>
> for $attr in $j//@*
> return
> <attribute>
> {$attr}
> </attribute>
> 
> i will get
> all attribute names with their values
> 
> i want to get attribue name in a node and its value in
> another node
> example of the output i need is
> <attr_name>
> firstname
> <attrvalue>
> joe
> </attrvalue>
> </attr_name>
> <attr_name>
> 
> <attr_name>
> lastname
> <attrvalue>
> carlon
> </attrvalue>
> </attr_name>
> <attr_name>
> i need to separate the attribute name from its value
> in the output
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> _______________________________________________
> talk at xquery.com
> http://xquery.com/mailman/listinfo/talk
> 



More information about the talk mailing list