|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: copy-of question
Hi Franz, > Yes. The default rules gives the unmatched elements back as > unformattet text I guess. Coult You give me an example to extract > only an element out of a huge xml? Well, you can either approach it from a pull direction or a push direction. If you want to pull, then you should find an XPath that identifies the single node that you want to copy from the root node of the tree, perhaps through id() or by stepping down to it. I don't know what your XML looks like, unfortunately, so I can only say that: //TABLE will work to point at the TABLE element in your XML. There may be a much better path - this one is far from optimal because it uses the descendant-or-self:: axis, which is very inefficient. Then you should have a single template that operates very near the top of the tree (often the root node), and that copies only this one node: <xsl:template match="/"> <xsl:copy-of select="//TABLE" /> </xsl:template> The push method would involve changing the default templates. To get no output by default, you only need to change the template that matches text() nodes, making it do nothing rather than giving the value of the text. So just add the template: <xsl:template match="text()" /> to your current stylesheet. Which one is most efficient depends on the structure of your XML, the processor you're using and whether you can come up with a better XPath to access the node you're interested in. Generally I'd go for pull in this situation. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








