Subject: [xsl] Applying transforms to parent nodes based on child node From: "Derek Hinchliffe" <dhinchliffe@xxxxxxxxxx> Date: Wed, 21 Jan 2004 12:21:10 +0800 |
Hi all, I'm am trying to use XSLT to modify certain nodes of an XML document. For the most part, nodes are just copied using copy-of, except when they contain an attribute of style='strip', in which case only the CDATA is copied, thus stripping the XML tags away. This seems fairly simple, as is so far achieved with: <!--Snippet--> <xslt:template match="*[@style='strip']"> <xslt:value-of select="."/> </xslt:template> <xslt:template match="*"> <xslt:copy> <xslt:copy-of select="@*" /> <xslt:apply-templates /> </xslt:copy> </xslt:template> <!--Snippet--> However, now I want to also strip the tags from the parent of the node with style='strip'. Example: ---------------- <root> <item>Don't remove these tags</item> <item>Remove <subitem style="strip">these tags</subitem></item> </root> would become: <root> <item>Don't remove these tags</item> Remove these tags </root> ----------------- I'm fairly new to XSLT, and it seems like all the examples and tutorials around deal with different use cases than mine (usually grabbing data and formatting it, rather than just making modifications to small parts of the XML document). I'm guessing it has something to do with using the Parent:: axis, but I can't figure out how to go about it, so any help would be appreciated. Cheers Derek XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Another days of the week , Michael Kay | Thread | Re: [xsl] Applying transforms to pa, J.Pietschmann |
RE: [xsl] Another days of the week , Michael Kay | Date | [xsl] Any screen painter tool avila, Arulraj |
Month |