Skip to content

Instantly share code, notes, and snippets.

@welblaud
Last active May 6, 2020 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save welblaud/f3b66598294f494b71e0e76a03941cfd to your computer and use it in GitHub Desktop.
Save welblaud/f3b66598294f494b71e0e76a03941cfd to your computer and use it in GitHub Desktop.
Simple replacement for DOCX nodes
<?xmlversion='1.0'?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:w='http://schemas.openxmlformats.org/wordprocessingml/2006/main'
version='1.0'>
<xsl:template match="w:document/w:body/w:p/w:r/w:t[node()='Hello World']">
<w:t>Goodbye World</w:t>
</xsl:template>
<!-- The following transform is the identity transform -->
<xsl:templatematch="/|@*|node()">
<xsl:copy>
<xsl:apply-templatesselect="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment