xsl-list
[Top] [All Lists]

Re: Transform XML to XML

2005-08-26 06:56:42
Mike,

At 04:54 AM 8/26/2005, David wrote:
        I guess, like security best practices, my mindset is "don't
       allow it unless I explicitly ask for it."
        But I guess it doesn't work that way so I shouldn't fight it.

I typically begin every stylesheet with a template that looks like

<xsl:template match="*">
<xsl:message>Unsupported element: <xsl:value-of select="name()"/></xsl:message>
</xsl:template>

and so have to keep adding templates until my stylesheet stops moaning
on all test cases.

Notice that this override of the built-in default template of David's also has the effect of stopping processing of the tree for branches where it matches (that is, for templates not matched by a "better" template). So until he writes a template to match an element, that element and its contents are now *suppressed* by default.

He could work in a somewhat less draconian fashion (at the cost of seeing many more of these messages early on) if his template had:

<xsl:template match="*">
  <xsl:message>Unsupported element:
   <xsl:value-of select="name()"/></xsl:message>
  <xsl:apply-templates/>
</xsl:template>

Finally, in order to see how this all hangs together one needs to understand how the processor decides which template to use when several templates match a node....

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>