RE: Renaming an element - getting a value without tags
"Michael Kay" <[email protected]> Thu, 18 Aug 2005 09:05:27 +0100
| Newsgroups | gmane.comp.web.query-languages |
|---|---|
| Message-ID | <[email protected]> |
To copy the text node children of <old>, use $value/text() To copy all the children of <old>, including comments and PIs, use $value/node() To copy the typed value of <old>, use data($value) If the content of your element is a simple string these will all do the same thing. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Jule Kleine > Sent: 18 August 2005 00:53 > To: [email protected] > Subject: Renaming an element - getting a value without tags > > > > Hi, > > I would like to use xquery to rename an element: > > > <text> > <old>value</old> > </text> > > > should then be: > > <text> > <new>value</new> > </text> > > ----- > > My XQuery is: > > for $text in doc("sample.xml")/text > > let $value := $text/old > let $outputValue := <new>{$value}</new> > > return > ( > <text> > {$outputValue} > </text> > ) > > > What I get is: > > <text> > <new> > <old>value</old> > </new> > </text> > > > Is there any chance to get $value without it's start and endtag ? > As far as I know I cannot get the text of an element with > xpath, right ? So is there a way to solve it in xquery ? > I was experimenting with different forms of {$value} and > $value and was searching in all examples I could get but > couldnt solve the problem, I hope you know some help.... > > Thank you > Jule > > > > > > ______________________________________________________________ > ___________ > Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle > Freunde gleichzeitig schicken: > http://freemail.web.de/features/?mc=021179 > > > > >