[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] referring to variables using variables?


Subject: RE: [xsl] referring to variables using variables?
From: "james walker" <jameswalkerandy@xxxxxxxxxxx>
Date: Tue, 13 Jan 2004 13:59:26 +0000

Hello again,
I bound a namespace prefix xmlns and it doesnt complain when i translate it but the output does not show content from any of the imported documents. Also in the ouput, the statement xmlns:xx="urn:schemas-microsoft-com:xslt" is included in each <h1> tag as a paramter??


<xsl:stylesheet version="1.0" xmlns:xx="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<!--Load people in xml files-->
<xsl:variable name="index">
<HR>http...</HR>
<Recruitment_and_Hiring>http...</Recruitment_and_Hiring>
<New_Managers>http...</New_Managers>
<New_Starters>http...</New_Starters>
</xsl:variable>
<xsl:variable name="nsindex" select="xx:node-set($index)/*"/>


<xsl:template match="root">
<h1 class="page-title"><xsl:value-of select="./category/name" /></h1>
<p><xsl:value-of select="./category/description" /></p>
<xsl:apply-templates select="category/category/category[name='People In']" />
</xsl:template>


<xsl:template match="category">

<xsl:if test="count(ancestor::*)=3">
<xsl:variable name="colour" select="../@colour" />
<h2 class="head-hurs-{$colour}" style="margin-top:20px;"><xsl:value-of select="name" /></h2>
<p><xsl:value-of select="description" /></p>
<xsl:apply-templates select="./category" />
</xsl:if>


<xsl:if test="count(ancestor::*)=4">
<div style="float:left;" class="general-portlet">
<xsl:variable name="subcatcolor" select="../../@colour" />
<xsl:variable name="catname" select="name" />
<h2 class="head-hurs-{$subcatcolor}"><xsl:value-of select="name" /></h2>
<p><xsl:value-of select="description" /></p>
<ul class="in-portlet">
<xsl:for-each select="document($nsindex/*[name()=$catname])/root/child::*">
CONTENT
</xsl:for-each>
</ul>
</div>
<xsl:apply-templates select="./category" />
</xsl:if>


</xsl:template>

</xsl:stylesheet>

I changed xmlns to another name but that didnt work and also tried david carlisle's suggestion for xalan but it said that namespace "http://exslt.org/common" does not contain any functions......


From: "Michael Kay" <mhk@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] referring to variables using variables?
Date: Tue, 13 Jan 2004 13:37:22 -0000

> i changed xx in select="xx:node-set($index)/*" to xmlns and
> changed the
> select function slightly to match the brackets  <xsl:for-each
> select="document($nsindex/*[name()=$catname])/root/child::*">
> . It says
> 'Namspace " does not contain any functions ', does anyone
> know what this
> means?

You need to bind the namespace prefix xx to a namespace that contains
the function with local-name "node-set". This depends on the XSLT
processor you are using. It looks as if you bound it to the null
namespace, and the null namespace does not contain any functions.

Michael Kay


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

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger



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




Current Thread
Keywords