sacha74 Posted March 1, 2010 Share Posted March 1, 2010 I would like to delete the <DIV> tags while keeping all the tags that are in the <Div> tag. The problem is that in the code there are <DIV> tags in other <DIV> tags.The original code: <XML><Map-Start><A ID="pgfId-592691"/></Map-Start> <Bloc-paragraphe><A ID="pgfId-596086"/>074 is used to customise application codes for the administration of time and call fiduciary deposit orders. </Bloc-paragraphe><Map><A ID="pgfId-596087"/>information </Map> <Bloc-paragraphe> <A ID="pgfId-596106"/>ggjug guigik </Bloc-paragraphe><DIV> <IMAGE xml:link="simple" href="074-1.gif" show="embed" actuate="auto"/> </DIV> <DIV> <FM2Titre><A ID="pgfId-596112"/>access key</FM2Titre> <DIV> <FM3Titre><A ID="pgfId-596113"/></FM3Titre> <Bloc-paragraphe><A ID="pgfId-596114"/>position to: </Bloc-paragraphe> <DIV> <Liste-Puce><A ID="pgfId-596115"/>a new application code,</Liste-Puce></DIV></DIV></DIV></XML> My xslt: <xsl:template match="node()"> <xsl:copy> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> <xsl:template match="A|T-No|T-######|IMAGE"/> <xsl:template match="DIV|DIV/DIV|DIV/DIV/DIV"> <xsl:copy-of select="node()"/> </xsl:template> What I would like to obtain: <XML><Map-Start><A ID="pgfId-592691"/></Map-Start> <Bloc-paragraphe><A ID="pgfId-596086"/>074 is used to customise application codes for the administration of time and call fiduciary deposit orders. </Bloc-paragraphe><Map><A ID="pgfId-596087"/>information </Map> <Bloc-paragraphe> <A ID="pgfId-596106"/>ggjug guigik </Bloc-paragraphe> <IMAGE xml:link="simple" href="074-1.gif" show="embed" actuate="auto"/> <FM2Titre><A ID="pgfId-596112"/>access key</FM2Titre> <FM3Titre><A ID="pgfId-596113"/></FM3Titre> <Bloc-paragraphe><A ID="pgfId-596114"/>position to: </Bloc-paragraphe> <Liste-Puce><A ID="pgfId-596115"/>a new application code,</Liste-Puce></XML> Can you help me to understand how to treat all the <DIV> tags even those which are DIV/DIV/DIV/DIV.Do you have any ideas?Thanks in advance for all the help I could find. Link to comment Share on other sites More sharing options...
Martin Honnen Posted March 2, 2010 Share Posted March 2, 2010 It seems like you want the identity template plus a template for 'DIV' elements which processes the child nodes: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="DIV"> <xsl:apply-templates/> </xsl:template></xsl:stylesheet> Link to comment Share on other sites More sharing options...
sacha74 Posted March 3, 2010 Author Share Posted March 3, 2010 Thanks a lot for your help very kind Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.