gatwick2002
Programmer
My XML (version 1):
[q]
<?xml version="1.0" encoding="utf-8"?>
<w:document xmlns:ve=" xmlns="urn:schemas-microsoft-comfficeffice" xmlns:r=" xmlns:m=" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp=" xmlns:w10="urn:schemas-microsoft-comffice:word" xmlns:w=" xmlns:wne=" <w:body>
<!--7-35|LTD_START--><w>
</w><!--7-35|LTD_END-->
<!--7-36|LTD_START--><w>
<w:r>
<w:t>This is a marketing requirement document.</w:t>
</w:r>
</w><!--7-36|LTD_END-->
<w>
<w:r w:rsidRPr="00FE6F45">
<w:t>$$$$$ ADDED PARA $$$$$</w:t>
</w:r>
</w>
<!--7-37|LTD_START--><w>
<w:r>
<w:t>Our objectives with this MRD are several:</w:t>
</w:r>
</w><!--7-37|LTD_END-->
</w:body>
</w:document>
[/q]
My XML (version 2):
[q]
<?xml version="1.0" encoding="utf-8"?>
<w:document xmlns:ve=" xmlns="urn:schemas-microsoft-comfficeffice" xmlns:r=" xmlns:m=" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp=" xmlns:w10="urn:schemas-microsoft-comffice:word" xmlns:w=" xmlns:wne=" <w:body>
<!--7-35|LTD_START--><w>
</w><!--7-35|LTD_END-->
<!--7-36|LTD_START--><w>
<w:r>
<w:t>This is a marketing requirement document.</w:t>
</w:r>
</w><!--7-36|LTD_END-->
<w>
<w:r w:rsidRPr="00FE6F45">
<w:t>$$$$$ ADDED PARA $$$$$</w:t>
</w:r>
</w>
<!--7-37|LTD_START--><w>
<w:r>
<w:t>Our objectives with this MRD are several:</w:t>
</w:r>
</w><!--7-37|LTD_END-->
</w:body>
</w:document>
[/q]
My XML (version 3):
[q]
<?xml version="1.0" encoding="utf-8"?>
<w:document xmlns:ve=" xmlns="urn:schemas-microsoft-comfficeffice" xmlns:r=" xmlns:m=" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp=" xmlns:w10="urn:schemas-microsoft-comffice:word" xmlns:w=" xmlns:wne=" <w:body>
<!--7-35|LTD_START--><w>
</w><!--7-35|LTD_END-->
<!--7-36|LTD_START--><w>
<w:r>
<w:t>This is a marketing requirement document.</w:t>
</w:r>
</w><!--7-36|LTD_END-->
<w></w>
<w>
<w:r w:rsidRPr="00FE6F45">
<w:t>$$$$$ ADDED PARA $$$$$</w:t>
</w:r>
</w>
<!--7-37|LTD_START--><w>
<w:r>
<w:t>Our objectives with this MRD are several:</w:t>
</w:r>
</w><!--7-37|LTD_END-->
</w:body>
</w:document>
[/q]
XSL:
[q]
<xsl:stylesheet xmlns:xsl=" xmlns:w=" xmlns:a=" xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:WX=" xmlns:aml=" xmlns:w10="urn:schemas-microsoft-comffice:word"
xmlns:wp=" xmlns:r=" xmlns:rs=" xmlns:exsl=" exclude-result-prefixes="exsl"
version="1.0">
<xslutput method="xml" encoding="utf-8" indent="no"/>
<xsl:template match="w[w:smartTag[@w:element='livetechdocs']/w:smartTagPr/w:attr[@w:name='remap']][count(ancestor::w:tbl)=0]">
<xsl:if test="preceding::node()[normalize-space()][1]">
<xsl:if test="preceding::node()[normalize-space()][1][self::comment()]">
<xsl:message>COMMENT DETECTED: <xsl:value-of select="preceding::node()[normalize-space()][1][self::comment()]"/></xsl:message>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
[/q]
How should I make it output COMMENT DETECTED: 7-36|LTD_END ONLY for version 1 & 2?
[q]
<?xml version="1.0" encoding="utf-8"?>
<w:document xmlns:ve=" xmlns="urn:schemas-microsoft-comfficeffice" xmlns:r=" xmlns:m=" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp=" xmlns:w10="urn:schemas-microsoft-comffice:word" xmlns:w=" xmlns:wne=" <w:body>
<!--7-35|LTD_START--><w>
</w><!--7-35|LTD_END-->
<!--7-36|LTD_START--><w>
<w:r>
<w:t>This is a marketing requirement document.</w:t>
</w:r>
</w><!--7-36|LTD_END-->
<w>
<w:r w:rsidRPr="00FE6F45">
<w:t>$$$$$ ADDED PARA $$$$$</w:t>
</w:r>
</w>
<!--7-37|LTD_START--><w>
<w:r>
<w:t>Our objectives with this MRD are several:</w:t>
</w:r>
</w><!--7-37|LTD_END-->
</w:body>
</w:document>
[/q]
My XML (version 2):
[q]
<?xml version="1.0" encoding="utf-8"?>
<w:document xmlns:ve=" xmlns="urn:schemas-microsoft-comfficeffice" xmlns:r=" xmlns:m=" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp=" xmlns:w10="urn:schemas-microsoft-comffice:word" xmlns:w=" xmlns:wne=" <w:body>
<!--7-35|LTD_START--><w>
</w><!--7-35|LTD_END-->
<!--7-36|LTD_START--><w>
<w:r>
<w:t>This is a marketing requirement document.</w:t>
</w:r>
</w><!--7-36|LTD_END-->
<w>
<w:r w:rsidRPr="00FE6F45">
<w:t>$$$$$ ADDED PARA $$$$$</w:t>
</w:r>
</w>
<!--7-37|LTD_START--><w>
<w:r>
<w:t>Our objectives with this MRD are several:</w:t>
</w:r>
</w><!--7-37|LTD_END-->
</w:body>
</w:document>
[/q]
My XML (version 3):
[q]
<?xml version="1.0" encoding="utf-8"?>
<w:document xmlns:ve=" xmlns="urn:schemas-microsoft-comfficeffice" xmlns:r=" xmlns:m=" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp=" xmlns:w10="urn:schemas-microsoft-comffice:word" xmlns:w=" xmlns:wne=" <w:body>
<!--7-35|LTD_START--><w>
</w><!--7-35|LTD_END-->
<!--7-36|LTD_START--><w>
<w:r>
<w:t>This is a marketing requirement document.</w:t>
</w:r>
</w><!--7-36|LTD_END-->
<w></w>
<w>
<w:r w:rsidRPr="00FE6F45">
<w:t>$$$$$ ADDED PARA $$$$$</w:t>
</w:r>
</w>
<!--7-37|LTD_START--><w>
<w:r>
<w:t>Our objectives with this MRD are several:</w:t>
</w:r>
</w><!--7-37|LTD_END-->
</w:body>
</w:document>
[/q]
XSL:
[q]
<xsl:stylesheet xmlns:xsl=" xmlns:w=" xmlns:a=" xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:WX=" xmlns:aml=" xmlns:w10="urn:schemas-microsoft-comffice:word"
xmlns:wp=" xmlns:r=" xmlns:rs=" xmlns:exsl=" exclude-result-prefixes="exsl"
version="1.0">
<xslutput method="xml" encoding="utf-8" indent="no"/>
<xsl:template match="w[w:smartTag[@w:element='livetechdocs']/w:smartTagPr/w:attr[@w:name='remap']][count(ancestor::w:tbl)=0]">
<xsl:if test="preceding::node()[normalize-space()][1]">
<xsl:if test="preceding::node()[normalize-space()][1][self::comment()]">
<xsl:message>COMMENT DETECTED: <xsl:value-of select="preceding::node()[normalize-space()][1][self::comment()]"/></xsl:message>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
[/q]
How should I make it output COMMENT DETECTED: 7-36|LTD_END ONLY for version 1 & 2?