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

RE: <xsl:copy-of>

Subject: RE: <xsl:copy-of>
From: "Palaniappan, Krishnasamy" <PalaniK@xxxxxxxxxxx>
Date: Wed, 10 Jan 2001 14:14:37 -0500
krish palaniappan
Hi Jeni,
	Thanks for your inputs. What I am exactly looking for is something like this..

let's say, I have the following pattern repeating several times in my stylesheet:
			<xsl:choose>
				<xsl:when condition>
					do something...
				</xsl:when>
				<xsl:otherwise>
					print something
				</xsl:otherwise>
			</xsl:choose>

I would like to replace this with:

			<xsl:choose>
				<xsl:when condition>
					do something...
				</xsl:when>
				<xsl:copy-of select="$paste"/>
			</xsl:choose>
					
		where $paste is retrieved from:
			<xsl:variable name="paste">
				<xsl:otherwise>
					print something
				</xsl:otherwise>
			</xsl:variable>

The only reason I want to do this, is to condense my stylesheet.
However, I get an error that says something to the effect that:
"You cannot use <xsl:otherwise> without <xsl:choose>".

Is there a way I can forcibly copy something without any validation?

Thanks,
Krish
		

-----Original Message-----
From: Jeni Tennison [mailto:mail@xxxxxxxxxxxxxxxx]
Sent: Tuesday, January 09, 2001 8:06 PM
To: Palaniappan, Krishnasamy
Cc: 'xslt'
Subject: Re:  <xsl:copy-of>


Hi Krish,

> I have a variable defined like this:
>                 <xsl:variable name="try">
>                  <xsl:call-template name="tableheadingDT">
>                  <xsl:with-param name="bcolor" select="'LIGHTSKYBLUE'"/>
>                 </xsl:variable>
> I want to call it using:
>                 <xsl:copy-of select="$try"/>
>                 <xsl:with-param name="param1" values="'value1'"/> <!-- 2nd parameter to the template above is passed here -->
>                 </xsl:call-template> <!-- closing the template opened above -->

It's not exactly clear what you're trying to achieve with this. Is it
that you have two calls to the 'tableheadingDT' template and want to
make sure that the second call uses the same parameter values as the
first, as well as the additional one?  In other words, do you want a
less repetitive method than:

  <xsl:call-template name="tableheadingDT">
     <xsl:with-param name="bcolor" select="'LIGHTSKYBLUE'" />
  </xsl:call-template>
  <xsl:call-template name="tableheadingDT">
     <xsl:with-param name="bcolor" select="'LIGHTSKYBLUE'" />
     <xsl:with-param name="param1" select="'value1'" />
  </xsl:call-template>

You could put the value for the $bcolor parameter into a variable, and
use that in both calls:

  <xsl:variable name="bcolor" select="'LIGHTSKYBLUE'" />
  <xsl:call-template name="tableheadingDT">
     <xsl:with-param name="bcolor" select="$bcolor" />
  </xsl:call-template>
  <xsl:call-template name="tableheadingDT">
     <xsl:with-param name="bcolor" select="$bcolor" />
     <xsl:with-param name="param1" select="'value1'" />
  </xsl:call-template>

But other than that, the closest you can get is to declare a general
entity that holds the xsl:with-param for the $bcolor parameter and use
that:

<!ENTITY bcolor-param
  '<xsl:with-param name="bcolor" select="&apos;LIGHTSKYBLUE&apos;" />'>

[I think] and then:

  <xsl:call-template name="tableheadingDT">
     &bcolor-param;
  </xsl:call-template>
  <xsl:call-template name="tableheadingDT">
     &bcolor-param;
     <xsl:with-param name="param1" select="'value1'" />
  </xsl:call-template>

Sorry I can't be more help.  Perhaps if you described what you wanted
to achieve we could find something else,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


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.