[xsl] Problems passing parameters

Subject: [xsl] Problems passing parameters
From: "Tibbetts, Jeffery A. NGIC" <frtibja@xxxxxxxxxxxxx>
Date: Fri, 25 Feb 2005 12:58:58 -0500
I am unsuccessfully trying to access the value of a passed parameter.  The
overall effort here is to open a linked document and provide the requisite
path to the linked file to replace links to a generic http://hostname
address with a local path (think of making a cd layout from a set of web
documents based on an RSS feed).

This is the relevant part of the stylesheet code.  I seem to be able to
access the value of the passed parameter with a value-of select statement,
but as soon as I nest the call to the parameter inside a choose/when
statement I get an empty string.  It seems to me the passed parameter is
supposed to be in context throughout the template, so I am unsure of why I
can access it in one manner but not another.

If there is another manner of accessing this information from the file
itself without passing it as a parameter I am open to suggestions.  Thus far
I have not been able to find another way.  Please help.


<xsl:template match="item/link">
<xsl:variable name="test" select="../link/text()"/>
<xsl:variable name=initial select="concat('/home_directory',
(substring-after($test, 'http://www.hostname')))"
<xsl:for-each select="document($initial)/>
<xsl:document href="{concat($inital,'l')}" method="html"
encoding="ISO-8859-1" omit-xml-declaration="no">
<xsl:apply-templates mode="internal_url">
<xsl:with-param name="initial" select=$initial/>
</xsl:apply-templates>
</xsl:document>

<xsl:template match="@*|node()" mode="internal_url">
<xsl:with-param name="initial">
<xsl:choose>
<xsl:when test="string-length(@href)='19' and contains(@href,
'http://www.hostname)'">
	<xsl:choose>
		<xsl:when test=contains($initial, '/')>
			<!--nested choose statements until I get to 8 levels
of depth -not repeated here - -->
		</xsl:when>
		<xsl:otherwise>
		<xsl:variable name="level" select=concat('./', 'index.htm')
		<a href={concat('./','index.htm')><xsl:apply-templates
mode="internal_url"/></a>
		</xsl:otherwise>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*|node() mode="internal_url"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

Jeffrey A. Tibbetts
Markup Language Specialist
National Ground Intelligence Center
980-7782
frtibja@xxxxxxxxxxxxx

Current Thread