[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: mode

Subject: Re: mode
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 14 Apr 2011 15:34:55 -0400
Re:  mode
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@xxxxxxxxxxxxxxxxxxxx
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.