I don't think a single template helps. What you could do is use two processing steps where the first adds the 'ADDED' elements and the second numbers them:
Code:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl"
version="1.0">
<xsl:template match="/">
<xsl:variable name="temp1">
<xsl:apply-templates/>
</xsl:variable>
<xsl:apply-templates select="exsl:node-set($temp1)" mode="m1"/>
</xsl:template>
<xsl:template match="/ | @* | node()" mode="m1">
<xsl:copy>
<xsl:apply-templates select="@* | node()" mode="m1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="ADDED" mode="m1">
<xsl:copy>
<xsl:text>1-</xsl:text>
<xsl:number level="any"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="w:tbl//w:p">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:variable name="n">
<xsl:number from="w:tbl" level="any"/>
</xsl:variable>
<xsl:if test="$n = 1">
<ADDED></ADDED>
</xsl:if>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="w:p[not(ancestor::w:tbl)]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<ADDED/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
With that stylesheet when I transform
Code:
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p>
</w:p>
<w:p>
</w:p>
<w:p>
</w:p>
<w:tbl>
<w:tr w:rsidR="0065563E" w:rsidTr="0065563E">
<w:trPr>
<w:cnfStyle w:val="100000000000"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:cnfStyle w:val="001000000000"/>
<w:tcW w:w="2394" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C">
<w:r>
<w:t>Header</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="2394" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="0065563E" w:rsidRDefault="0065563E" w:rsidP="0015368C">
<w:pPr>
<w:cnfStyle w:val="100000000000"/>
</w:pPr>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="2394" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="0065563E" w:rsidRDefault="0065563E" w:rsidP="0015368C">
<w:pPr>
<w:cnfStyle w:val="100000000000"/>
</w:pPr>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p>
</w:p>
<w:p>
<w:r>
<w:t>Image inserted</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
I get
Code:
<?xml version="1.0" encoding="utf-8"?><w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p><ADDED>1-1</ADDED>
</w:p>
<w:p><ADDED>1-2</ADDED>
</w:p>
<w:p><ADDED>1-3</ADDED>
</w:p>
<w:tbl>
<w:tr w:rsidR="0065563E" w:rsidTr="0065563E">
<w:trPr>
<w:cnfStyle w:val="100000000000"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:cnfStyle w:val="001000000000"/>
<w:tcW w:w="2394" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="0065563E" w:rsidRDefault="003A0CBE" w:rsidP="0015368C"><ADDED>1-4</ADDED>
<w:r>
<w:t>Header</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="2394" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="0065563E" w:rsidRDefault="0065563E" w:rsidP="0015368C">
<w:pPr>
<w:cnfStyle w:val="100000000000"/>
</w:pPr>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="2394" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="0065563E" w:rsidRDefault="0065563E" w:rsidP="0015368C">
<w:pPr>
<w:cnfStyle w:val="100000000000"/>
</w:pPr>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p><ADDED>1-5</ADDED>
</w:p>
<w:p><ADDED>1-6</ADDED>
<w:r>
<w:t>Image inserted</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
The only problem with a two step transformation in XSLT 1.0 is that you need to use an extension function to convert a result tree fragment into a node-set. The stylesheet I posted uses the EXSLT node-set function, you will need to check the documentation of your XSLT processor whether it supports that function or maybe a function in a different namespace.