Last active
August 29, 2015 14:06
-
-
Save andrewminton/3ce8592d1b7ccd103630 to your computer and use it in GitHub Desktop.
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
<data> | |
<hello>paste your xml here</hello> | |
<entry><title message="error"></title></entry> | |
<entry><title message="error"></title></entry> | |
<entry><title message="error"></title></entry> | |
<entry><title message="error"></title></entry> | |
</data> |
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
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
<xsl:output method="xml" indent="yes" /> | |
<xsl:template match="/"> | |
<hi> | |
<xsl:value-of select="data/hello" /> | |
</hi> | |
<xsl:apply-templates select="entry" mode="errors"/> | |
</xsl:template> | |
<xsl:template match="entry" mode="errors"> | |
<xsl:if test="title/@message = 'error'"> | |
<xsl:call-template name="error-check"> | |
<xsl:with-param name="error-count" select="$error-count + 1"/> | |
<xsl:if test="position() = last()"> | |
<xsl:value-of select="$error-count"/> | |
</xsl:call-template> | |
</xsl:if> | |
</xsl:template> | |
<xsl:template name="error-count"> | |
<xsl:param name="error-count" select="0"/> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment