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

An XSLT puzzle

Subject: An XSLT puzzle
From: "Alexander Gutman" <gutman@xxxxxxxxxxxxxxx>
Date: Mon, 30 Jul 2001 19:48:44 +0700
 An XSLT puzzle
Hello, friends.

Imagine the following exotic situation.
A stylesheet contains a named template, say

  <xsl:template name="qq">...</xsl:template>

with "..." an arbitrary valid XSLT code.
This template is to be used in two different "regimes".
The first regime is the usual one: the template
is called via

  <xsl:call-template name="qq"/>

The second regime is exotic: the template's 
content is identically copied into the output
(as a result tree fragment).

For instance, let the stylesheet be as follows:

  <xsl:template name="qq">
    <node attr="{2+2=4}"/>
  </xsl:template>

  <xsl:template match="/">
    <results>
      <usual-result>
        <xsl:call-template name="qq"/>
      </usual-result>
      <exotic-result>
        ... your code ...
      </exotic-result>
    </results>
  </xsl:template>

Then the result of transforming a document
via this stylesheet should be as follows:

  <results>
    <usual-result>
      <node attr="true"/>
    </usual-result>
    <exotic-result>
      <node attr="{2+2=4}"/>
    </exotic-result>
  </results>

The task is to find a pure XSLT solution.
An interesting puzzle, isn't it?
(Not so difficult, though.)

-- 
Alexander E. Gutman

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • An XSLT puzzle
    • Alexander Gutman - Mon, 30 Jul 2001 08:53:22 -0400 (EDT) <=
      • <Possible follow-ups>
      • Oliver Becker - Mon, 30 Jul 2001 09:29:41 -0400 (EDT)

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.