Hello xsl-list,
How does namespace work?
File.xml transformed with StyleSheet1:
Gives Error:
xml transformation failed due the following error
Reference to undeclared namespace prefix: 'str'.
Stylesheet1 includes Stylesheet2 includes StyleSheet3
If I drop str: from <xsl:call-template name="str:change-case"> (StyleSheet1)
and
the the named template in StyleSheet3. Then it all works fine?
--------------
StyleSheet1 Has include for StyleSheet2
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:include href="util_vb6.xsl" />
<xsl:output method="text" />
<!-- Main entry point. -->
<xsl:template match="/">
<xsl:call-template name="str:change-case">
<xsl:with-param name="value" select="'KP'"/>
</xsl:call-template>
...
-----------------
StyleSheet2:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="D:\Seipas\OOSAD\DBDesign4\StyleSheets\util-strings.xsl" />
...
-----------------
StlyeSheet3: Note namespace xmlns:str
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://www.seipas.com/namespaces/strings"
extension-element-prefixes="str">
<!--util-strings.xsl-->
<!--Utility for string-handling functionality.-->
<!-- Change case -->
<xsl:template name="str:change-case">
<xsl:param name="value"/>
<xsl:param name="case" select="'lower'"/>
<xsl:choose>
<xsl:when test="$case='lower'">
<xsl:value-of
select="translate($value,'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz') "/>
</xsl:when>
<xsl:when test="$case='upper'">
<xsl:value-of select="translate($value,
'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
</xsl:when>
<xsl:otherwise>
<!--Incorrect change-to passed in. So just return the original
string-->
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
...
--
Best regards,
Arthur mailto:ArthurMaloney(_at_)seipas(_dot_)com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list