Last active
July 13, 2020 16:08
-
-
Save john-craft/9fdc0e6e901cadd83ca37dc469a17e31 to your computer and use it in GitHub Desktop.
Remove hyphens and periods from IDs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
exclude-result-prefixes="#all" | |
version="2.0"> | |
<xsl:template match="@linkend | @id"> | |
<xsl:attribute name="{node-name(.)}"> | |
<xsl:value-of select="replace(., '[-.]', '')"/> | |
</xsl:attribute> | |
</xsl:template> | |
<xsl:template match="@*|node()"> | |
<xsl:copy> | |
<xsl:apply-templates select="@*|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