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

Re: xsl:apply-imports design pattern using a single st

Subject: Re: xsl:apply-imports design pattern using a single stylesheet
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Mon, 26 Apr 2004 14:45:58 -0700
revisionflag
Somebody's creating an editor :)


<xsl:template match="*"> <xsl:choose> <xsl:when test="@revisionflag='inserted'">

      </xsl:when>
      <xsl:when test="boolean(@revisionflag)">

      </xsl:when>
      <xsl:otherwise>

      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


best, -Rob


Christian Roth wrote:
Hi,

this question is in close relation to

<http://www.dpawson.co.uk/xsl/sect2/apply-imports.html>

of David Pawson's XSLT FAQ.

I have the problem to surround (almost) any element of a DTD (here:
DocBook) by an additional element based on one of its attributes. Example:

<phrase revisionflag="added">...</phrase>

should become

<inserted><phrase>...</phrase></inserted>

or

<para revisionflag="deleted">...</para>

should become

<deleted><para>...</para></deleted>


What I want is to have a mechanism like this pseudo-code:


<xsl:template match="*[@revisionflag]">
    if( revisionflag = "deleted" ) {

<deleted>
<xsl:apply-templates select=".", choosing among all defined templates except the one we're currently in />
</deleted>


} else if ( revisionflag == "inserted" ) {

<inserted>
<xsl:apply-templates select=".", choosing among all defined templates except the one we're currently in />
</inserted>


} else {

<xsl:apply-templates select=".", choosing among all defined templates except the one we're currently in />

    }
</xsl:template>

, so that I have to code the wrapping of the element only at one place.
According to the FAQ mentioned above, this can be achieved by using two
stylesheets, where the main one contains my pseudo-coded template using
<xsl:apply-imports /> instead of my described pseudo-<xsl:apply-
templates> functionality, and the second, imported one contains the
normal, element-specific templates.

Is there a design pattern that lets me code this functionality in one
single stylesheet?

Regards, Christian.

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.