xsl template match images xsl call-template name find xsl with-param n

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<xsl:template match="/images">
<xsl:call-template name="find">
<xsl:with-param name="what" select="'hires;preview;s240x320;'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="find">
<xsl:param name="what"/>
<xsl:choose>
<xsl:when test="not($what)">
Not found
</xsl:when>
<xsl:when test="image[@type=substring-before($what, ';')]">
Found:<xsl:value-of select="substring-before($what, ';')"/>
<xsl:apply-templates select="image[@type=substring-before($what, ';')]"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="find">
<xsl:with-param name="what" select="substring-after($what, ';')"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>