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

Re: applying templates to all but ...

Subject: Re: applying templates to all but ...
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Fri, 24 Sep 2004 08:49:55 -0400
Re:  applying templates to all but ...
Hi Jeni,

On Sep 24, 2004, at 8:08 AM, Jeni Tennison wrote:

The (cs:* except cs:creator) selects all child elements in the cs namespace, and then removes from that sequence the cs:creator child elements. It's slightly more understandable than using the self:: axis, I think.

Yes, indeed. My next question probably would have been "what is the self::axis doing here?" So thanks for that clarification.


Since, we're here, I wonder if you have any suggestions on expanding the logic of what I'm doing here?

I've modified the logic of my system (the stylesheets and the config schema) to have sort of two levels.

	1)   structural "class"
	2)  more concrete "type"

I then mandate the config file has definitions for the types article, book, and chapter, each of which reflect a "class." Those then serve as the generic fallback.

So, this is why:

<xsl:when test="$issuance = 'continuing'">
<xsl:apply-templates select="$style-biblio/cs:reftype[@name='article']/cs:*">
<xsl:with-param name="source" select="."/>
</xsl:apply-templates>
</xsl:when>


Now, where I want to extend this is to allow additional definitions in each class. Example for the above might be "article-newspaper."

Those optional types can then either inherit from the fallback (which means basically that the only thing they are modifying is minor punctuation, which would be handled in other templates; there's an inherit-from attribute in the config schema), or not. If not, then my template here has to say select="$style-biblio/cs:reftype[@name='article-newspaper']/cs:*".

What I think this means is I need yet another layer of xsl:choose; e.g.:

<xsl:when test="$issuance = 'continuing'">
<xsl:choose>
<xsl:when test="$style-biblio/cs:reftype[@name='article-newspaper']">
<xsl:apply-templates select="$style-biblio/cs:reftype[@name='article-newspaper']/cs:*">
<xsl:with-param name="source" select="."/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$style-biblio/cs:reftype[@name='article']/cs:*">
<xsl:with-param name="source" select="."/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:when>


This would work, but intuitively I feel like this is not a great approach (for one, it relies on hard-coding the types values; class is not directly coded in the config instances, though does structure the logic of validation).

Any better ideas?

Bruce

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.