xsl-list
[Top] [All Lists]

Re: [xsl] Copy-per-default

2011-04-21 10:43:24
Hi,

On 4/21/2011 4:08 AM, Fredrik Bengtsson wrote:
Yeah, things work great now, albeit with a caveat or two (see my
e-mail to Florent Georges).

I understand the point you are making regarding the *|/ template. It
has its benefits, but I am sort of a control freak or perfectionist
if you will. For my part, I'd really prefer "whitelisting" the things
I want to happen and being meticulous in the pattern design. Someone
suggested adding a "null" template for d:book/d:info specifically
instead of for *, but that'd be a form of blacklisting and relies on
me knowing any and all possible subnode types today and for all time
to come....

If you want absolutely to control what you get, you can take the "pull" approach and select just the nodes you want. So if d:book has a d:body child that you want, and you want no others (no d:info or anything else), you say

<xsl:template match="d:book">
  <xsl:apply-templates select="d:body"/>
</xsl:template>

XSLT is actually really good for control freaks, because you can control what you want to control and what you leave your own mitts off of, relegating control to other parts of the system. Commonly, we rely on schemas and validation to handle the whitelisting part of the problem. This level of control and meta-control does require understanding the processing model and the overall system design.

"Use the Force, Luke".

Cheers, Wendell

======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>