tags:

views:

46

answers:

3

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

A: 
 <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.

James Curran
i just found this, which answers what "@mode" is in the "match":Matches <title> elements that are children of <section> elements, and that have a short-name attribute.Sound right?
bmw0128
any idea about the dollar sign in this: <xsl:template match="rm:content[$object='people']" mode="rendered-content" priority="5">
bmw0128
I'm not sure what the "this" is you just found (did you forget to paste in a link?), but the mode *inside* the match attribute is well-defined, and specified in my answer. It's the separate `mode` attribute by itself that's the mystery.
James Curran
Anything inside the "match" attribute in an XPath expression. In XPath, $object is a varaible whose valaue is defined outside of that statement.
James Curran
you are correct, the link i meant to paste:http://msdn.microsoft.com/en-us/library/ms754602(VS.85).aspx
bmw0128
thx for the quick help!
bmw0128
A: 

In general, you are matching specific nodes with specific attributes in an XML file.

I suggest you look at a tutorial on XSL.

Bernard
A: 

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

  1. <xsl:template match="foo">
    and
  2. <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.

jasso