At 2011-04-14 12:20 -0700, Paul M wrote:
I am just questioning about modes. The below contrived xsl snippet
sets a mode if an element has a specific attribute.
Note your use of "./@type" is redundant ... saying "@type" is the
same when using select= (and not functioning as you would expect when
using match=, so good not to get into the habit).
For elements that have only one translation (and always will), I
look for mode #all. Since I am new to xsl, I have found that #all
seems to be discouraged.
Really? It very much has a use.
However, what would be the pattern than if I were to say have
several modes, and several dozen elements which are always the same
regardless of mode? Example or link to xsl is fine.
You can only specify a single mode when pushing nodes at your
stylesheet (using xsl:apply-templates) ... that is because the node
is pushed only once and has to unambiguously be in a single mode at the time:
http://www.w3.org/TR/2007/REC-xslt20-20070123/#applying-templates
To match a single template in a number of named modes, simply use a
space-separated list of the mode names:
http://www.w3.org/TR/2007/REC-xslt20-20070123/#element-template
http://www.w3.org/TR/2007/REC-xslt20-20070123/#modes
Remember that mode names can be namespace qualified. When I create
XSLT stylesheet libraries, I use two namespaces for the name of the
modes engaged therein: a public one that my library users are
allowed to use (to exploit the library), and a private one that my
library users are expressly told not to use (so as not to
inadvertently interfere with the operation of the library).
I hope this helps.
. . . . . . . . . . Ken
--
Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--