Advertisement

06.20.2008 at 01:40PM PDT, ID: 23503576 | Points: 500
[x]
Attachment Details

XSL: Nested stylesheets (namespace alias) problem

Asked by qwertq in Extensible Markup Language (XML), Cascading Style Sheets (CSS)

I am trying to create a template which will get called by name and I want it to contain a sub stylesheet and templates. The whole reason for this is i want top level variables but can not create them until the callme template is called. I do not want to have to pass them around to all the sub templates.

The xsl below is included on another stylesheet and called with <xsl:call-template name="callme"/>

Check out my code. Problem is it doesn't actually parse the sub: stuff, it just prints it in the code. What gives?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:sub="http://www.w3.org/1999/XSL/TransformAlias"
	xmlns:exslt="http://exslt.org/common"
	exclude-result-prefixes="xsl php exslt">
 
	<xsl:output method="html" media-type="text/html"
		indent="yes"
		omit-xml-declaration="yes"
		encoding="ISO-8859-1"/>
		
	<xsl:namespace-alias stylesheet-prefix="sub" result-prefix="xsl" />
 
	<xsl:template name="callme">
	
			<h1>Welcome</h1>
 
		<sub:stylesheet version="1.0">
 
			<sub:template match="/">
				<!-- Setting a param in this "stylesheet" to see if we can access it later -->
				<sub:param name="testval" select="'Yes, It worked.'"/>
				<sub:call-template name="test" />
			</sub:template>
 
			
			<sub:template name="test">
				Val: <sub:value-of select="$testval"/>
			</sub:template>
 
		</sub:stylesheet>
		
	</xsl:template>
 
</xsl:stylesheet>
 
Loading Advertisement...
 
[+][-]06.21.2008 at 04:28AM PDT, ID: 21837227

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.25.2008 at 07:13AM PDT, ID: 21865779

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 04:59AM PDT, ID: 21893612

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.30.2008 at 11:28PM PDT, ID: 21905318

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-39 / EE_QW_2_20070628