This is my Xml File…
<w:document>
<w:body>
<w:p>
<w:r>
<w:t>
Paragraph1
</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
This is my Second XML file…
<w:document>
<w:body>
<w:p>
<w:r>
<w:pict>
<v:shape>
<v:textbox>
<w:txbxContent>
<w:p>
<w:r>
<w:t>
Paragraph2
</w:t>
</w:r>
</w:p>
</w:txbxContent>
<v:textbox>
</v:shape>
</w:pict>
</w:r>
</w:p>
</w:body>
</w:document>
Here, i have written one xslt file and calling my template whenever i found //w:body/w:p/w:r/w:t.
for example,
<xsl:apply-templates select="//w:body/w:p[w:r[w:t]]">
</xsl:apply-templates>
my own template is
<xsl:template match="w:p">
Do something here
</xsl:template>
my xslt working correctly with my first xml document.But it is not working with second one and also some scenario like that.So, how can i achieve both of this scenario by modifying this query here…
<xsl:apply-templates select="?????"> <!-- how to find the case that also matching my second xml file -->
</xsl:apply-templates>
Please guide me get out of this issue…
Use:
You may aso change the template’s match attribute to be slightly more specific:
Complete code:
when this transformation is applied on the first provided XML document (namespace defined to make it well-formed):
the correct result is produced:
when the same transformation is applied on the second provided “XML” (it is severely malformed and I spent many minutes until I made it well-formed!!!):
again the wanted result is produced: