xsltproc firewall.xsl source.xml
diff --report-identical-files <(xsltproc firewall.xsl source.xml) expect
If the results of the process substitution are the same as the file expect, then the test has passed.
169.25 | |
169.25 | |
169.25 | |
169.25 | |
224.81 | |
158.87 | |
149.131 |
<?xml version="1.0"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="text" /> | |
<xsl:strip-space elements="*" /> | |
<xsl:template match="//firewallRule[action/text() = 'accept']"> | |
<xsl:apply-templates select="source|destination"/> | |
</xsl:template> | |
<xsl:template match="source|destination"> | |
<xsl:apply-templates select="ipAddress"/> | |
</xsl:template> | |
<xsl:template match="ipAddress"> | |
<xsl:value-of select="." /> | |
<xsl:text>
</xsl:text> | |
</xsl:template> | |
<!-- override default built-in text() template --> | |
<xsl:template match="text()" /> | |
</xsl:stylesheet> |