Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2010
    Posts
    33

    Unanswered: how to rename XML attribute?

    Hello

    How to rename xml attribute for all xml data in one table

    example
    <term id ="1">
    <term>book</term>
    <definition></definition>
    </term>
    I want to rename 'id' to 'term_id'

    so that my new xml data will be look like this

    <term term_id ="1">
    <term>book</term>
    <definition></definition>
    </term>
    This is my basic code which I used to rename XML tag from definision to definition .

    update term
    set term = xmlquery('copy $new := $TERM
    modify( for $j in $new/term/definision
    return do rename $j as "definition")
    return $new' );
    Which part do I have to alter which code above to rename attributes.

    Thank You.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Did you have a chance to look at examples in the manual, particularly the XPath notation for attributes?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •