Re: [xsl] Transform XML to XML

Subject: Re: [xsl] Transform XML to XML
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 26 Aug 2005 09:56:42 -0400
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@xxxxxxxxxxxxxxxx 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 ======================================================================

Current Thread