[xquery-talk] separating attribute name from its value

Michael Kay mhk at mhk.me.uk
Fri Mar 3 10:11:20 PST 2006


Your question is a bit confused because some of your start tags were
probably meant to be end tags, but I suspect you want something along the
lines

for $attr in $j//@*
return <attribute name="{name($attr)} value="{string($attr)}"/>

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: talk-bounces at xquery.com 
> [mailto:talk-bounces at xquery.com] On Behalf Of fatma helmy
> Sent: 03 March 2006 04:19
> To: talk at xquery.com
> Subject: [xquery-talk] separating attribute name from its value
> 
> 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