This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Stuck on meta-stylesheet problem


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@onebox.com - email
 

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]