Extract a certain part inXML document?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • milee051307
    New Member
    • Sep 2008
    • 1

    Extract a certain part inXML document?

    I am giving out an XML document as a response to request send by a client in which i advertise i have these categories of books.The clients wish that if he request with some id= Cooking the response XML should only have the elements within <Cooking> </Cooking> tags.How can i do this?
    following is a sample response i send out.
    <bookstore>
    <Cooking>
    <book category="COOKI NG">
    <title lang="en">Every day Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.00</price>
    </book>
    </Cooking>
    <Children>
    <book category="CHILD REN">
    <title lang="en">Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
    </book>
    </Children>
    <Web>
    <book category="WEB">
    <title lang="en">Learn ing XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
    </book>
    </Web>
    </bookstore>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Extract a certain part inXML document?

    [CODE=xml]// build the xml wrapper around this
    <xsl:copy-of select="//Cooking"/>[/CODE]

    Comment

    Working...