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

Stuck on meta-stylesheet problem

Subject: Stuck on meta-stylesheet problem
From: "Charles Knell" <cknell@xxxxxxxxxx>
Date: Thu, 23 May 2002 11:03:03 -0700
meta stylesheet
I am writing a stylesheet to create a second stylesheet.

The product stylesheet must have four parameters. I have included them
so:
	<xslt:param name="canEdit" />
	<xslt:param name="script" />
	<xslt:param name="css" />
	<xslt:param name="updateProc" />

There are no parameters passed to the first stylesheet, the task is to
create placeholders for the parameters which will be passed to the product
stylesheet during the final transformation.

Note that the namespace is "xslt" rather than "xsl" so that I can pass
the tags through the first tranformation as unmolested, and I use a "namespace-alias"
to define "xslt" as pointing to the standard "xsl" URL thus:

<xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl" />
so the product stylesheet will have the "xslt" prefix associated with
the correct namespace.

In order to get through the first transformation with my product stylesheet
parameter declarations intact, I pull this little kludge in the first
stylesheet:

	<xsl:variable name="v_updateProc">$updateProc</xsl:variable>
	<xsl:variable name="v_canEdit"><xsl:copy-of select="concat('{$','canEdit}')"
/></xsl:variable>
	<xsl:variable name="v_script"><xsl:copy-of select="concat('{$','script}')"
/></xsl:variable>
	<xsl:variable name="v_css"><xsl:copy-of select="concat('{$','css}')"
/></xsl:variable>
	<xsl:variable name="v_class"><xsl:copy-of select="concat('{$','class}')"
/></xsl:variable>


This leads to these tags further on in the body of the sheet:

<script language="JavaScript" src="{$v_script}"></script>
<link rel="stylesheet" href="{$v_css}" type="text/css" media="screen"
/>

These two work just as I expect, and when the product stylesheet is created,
the variable references in the "src" and "href" attributes are replaced
with the correct values.

My problem comes with the "canEdit" parameter. I wish to use its value
to determine whether or not to call a particular template. The construct
which I have tried (and which fails) is this:

	<xslt:if test="{$v_canEdit}='true'">
		<xslt:call-template name="saveButton" />
	</xslt:if>

My processor (Oracle's) returns this error:
ORA-20100: Error occurred while processing: XSL-1013: (Error) Error in
expression: '{$canEdit}='true''.


If I omit the curly braces like this:
	<xslt:if test="$v_canEdit='true'">
		<xslt:call-template name="saveButton" />
	</xslt:if>
I get this error:
ORA-20100: Error occurred while processing: XSL-1031: (Error) Variable
not defined: 'v_canEdit'

If I leave these curly braces in and remove them from the variable declaration
like this:
<xsl:variable name="v_canEdit"><xsl:copy-of select="concat('$','canEdit')"
/></xsl:variable>

I get the ame error as the other curly brace option.

At this point I am fresh out of ideas on how to procede, but still convinced
there must be a way to do this, perhaps much more cleanly than I have
so far devised.

Has anyone got any experience with this sort of two-stage transformation
involving parameters?
Thanks.

-- 
Charles Knell
cknell@xxxxxxxxxx - email
 

 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.