You can achieve this using the XPath string function, starting with
<xsl:template match="w:pStyle[starts-with(@w:val, 'Heading')]">
This simply matches all w: pStyle nodes , where the w: val attributes begin with the word Heading . Then you can place your own code in this template.
Here is an example of how you will use it in XSLT identity transformation
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="http://mynamespace.com"> <xsl:output method="xml" indent="yes"/> <xsl:template match="w:pStyle[starts-with(@w:val, 'Heading')]"> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
The aforementioned XSLT, unless you have added your own code where it says, will strip all the mathcing w: pStyle elements from XML.
Tim c
source share