I want to understand, in general, what this means:
<xsl:template match="foo:barLists[@mode = 'Dummy Filter']"
mode="dummy-filter-cache" priority="2">
I'm looking for some insight to what this does so I may learn a bit about XSL
I want to understand, in general, what this means:
<xsl:template match="foo:barLists[@mode = 'Dummy Filter']"
mode="dummy-filter-cache" priority="2">
I'm looking for some insight to what this does so I may learn a bit about XSL
<xsl:template
This element defines a template. We'll give it data later with an apply-template
element
match="foo:barLists[@mode = 'Dummy Filter']"
This template uses the element barLists
in the namespace foo
which has an attribute of mode
which is set to "Dummy Filter". i.e. <foo:barList mode="Dummy Filter"> .... </foo:barList>
mode="dummy-filter-cache"
This tempalte has a mode of "dummy-filter-cache". I have no idea what that means. w3schools.com only says about mode: "Optional. Specifies a mode for this template"
priority="2">
This tempate has a priority of 2. If there's another template which also matches that element with a priority of 1, that one wins.
mode
attribute of xsl:template
allows you to create several templates that have same match
attribute. With mode
you can choose which one of these templates gets applied in different cases. This might be useful if you need to apply the same content several times with different formatting at some of these times.
A template with a mode will be instantiated only when you have set the same mode on an xsl:apply-templates
element whose select
attribute matches the match
attribute on the xsl:template
element.
Let's suppose you have templates
<xsl:template match="foo">
<xsl:template match="foo" mode="bar">
Then <xsl:apply-templates select="foo" mode="bar"/>
will match the template #2 while
<xsl:apply-templates select="foo"/>
and <xsl:apply-templates/>
will match the template #1.