XPath query for change structure of xml document

33 views Asked by At

I have xml file with data:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<pets>
    <Pet>
        <id>9223372016900023061</id>
        <name>fish</name>
        <status>available</status>
    </Pet>
    <Pet>
        <id>9223372016900023062</id>
        <name>Mouse</name>
        <status>available</status>
    </Pet>
    <Pet>
        <id>9223372016900023066</id>
        <name>doggie</name>
        <status>available</status>
    </Pet>
    <Pet>
        <id>9223372016900023068</id>
        <name>Puff</name>
        <status>available</status>
    </Pet>
    <Pet>
        <id>9223372016900023069</id>
        <name>doggie</name>
        <status>available</status>
    </Pet>
    <Pet>
        <id>9223372016900023070</id>
        <name>doggie</name>
        <status>available</status>
    </Pet>
  </pets>

And I need to create xpath query (in format somthing like this: /pets/Pet..) which gives output like this:

#9223372016900023061 - fish

#9223372016900023062 - Mouse

#9223372016900023066 - doggie

#9223372016900023068 - Puff

#9223372016900023069 - doggie

#9223372016900023070 - doggie

Help please

1

There are 1 answers

0
Siebe Jongebloed On BEST ANSWER

If you are able to loop threw every Pet in your code you code use this:

concat('#',id,' - ', name)