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

RE: fallback to a default template in xsl processing

Subject: RE: fallback to a default template in xsl processing
From: "Paul Spencer" <xml-dev-list@xxxxxxxxxxxxxx>
Date: Fri, 25 Apr 2008 12:28:11 +0100
RE:  fallback to a default template in xsl processing
We would need to see your attempt and the source file to know what you are
doing wrong. The usual problem with default templates is that you pick up
more than you wanted. This can often be avoided by providing a partial path.

Regards

Paul Spencer

> -----Original Message-----
> From: Daly, April [mailto:april@xxxxxxxxxxx]
> Sent: 24 April 2008 20:43
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  fallback to a default template in xsl processing
>
>
> Hi,
> Thank you!
>
> I tried that and maybe I didn't set it up correctly....buts the
> nodes with 'named' templates (e.g., 'A' or 'B') were processed
> twice, once by the template with match='A' and the other by match='*'.
> Thanks for your help!
> Regards,
>
> April
> April L Daly
> Daly Web, Inc.
> ________________________________________
> From: Jim Earley [xml.jim@xxxxxxxxx]
> Sent: Thursday, April 24, 2008 3:38 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  fallback to a default template in xsl processing
>
> One approach for this is to use the following:
>
> <xsl:template match="*">
>   ...
> </xsl:template>
>
> Jim Earley
> XML Architect
> Flatirons Solutions Corp.
>
>
>
> -----Original Message-----
> From: Daly, April [mailto:april@xxxxxxxxxxx]
> Sent: Thursday, April 24, 2008 1:29 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  fallback to a default template in xsl processing
>
> Hi!
>
> I have what I hope is a simple question for the xsl/xpath gurus!
>
>
> I would like to be able to apply a default template within xsl
> 1.0 if no match is found.
> Currently I'm using an ugly  'brute-force' approach using <xsl:choose>:
>
> <xsl:choose>
>    <xsl:when test="name()='A' or name()='B'">
>       <xsl:apply-templates mode='namedTemplates' select='.'/>
>    </xsl:when>
>    <xsl:otherwise>
>       <xsl:apply-templates mode='defaultTemplates' select='.'/>
>    </xsl:otherwise>
> </xsl:choose>
>
>
> this is a simplfied example, but I hope it shows what I'm trying to do.
>
> Is there a better way to apply a named template if 'found'
> otherwise apply a default
> template?
>
> Thanks (in advance) for your help!
>
> April
> April L Daly
> Daly Web, Inc.

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.