T
Tjerk Wolterink
I have an xsl file wich xsl:includes this file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlnsage="http://www.wolterinkwebdesign.com/xml/page"
xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent">
<xslutput method="xml" indent="yes"/>
<xslaram name="absolute_url"/>
<xslaram name="upload_url"/>
<!--
! Default template for an image
!
!-->
<xsl:template name="image">
<xslaram name="max_width" select="200"/>
<xslaram name="img"/>
<xsl:if test="$img[xc:width]">
<xsl:choose>
<xsl:when test="$img[xc:error]/">
<b><xsl:value-of select="$img/xc:error"/></b>
</xsl:when>
<xsltherwise>
<img>
<xsl:attribute name="src">
<xsl:value-of select="$upload_url"/>/<xsl:value-of select="current()"/>
</xsl:attribute>
<xsl:if test="$img/@width>$max_width">
<xsl:attribute name="width"><xsl:value-of select="$max_width"/></xsl:attribute>
</xsl:if>
</img>
</xsltherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!--
! All html should remain html
!-->
<xsl:template match="*[namespace-uri(.) != namespace::xc]">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:apply-templates select="./node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
But now i get teh folowing error:
array(7) {
["msgtype"]=>
string(5) "error"
["code"]=>
string(2) "19"
["module"]=>
string(9) "Sablotron"
["URI"]=>
string(36) "file://C:/webserver/xsl/standard.xsl"
["line"]=>
string(2) "22"
["node"]=>
string(20) "element ''"
["msg"]=>
string(16) "pattern is empty"
}
So on line 22:
line 22: <xsl:when test="$img[xc:error]/">
the patternt is empty.
But $img should be a variable to a node, i tried <xsl:when test="current()[xc:error]/">
But that does not work.
What i want to do is call the template with name "image" whenever some element is found,
i give that element as an param $img with the template named "image".
But my xsl file that the above xsl includes do not ever call the template named "image".
So why is there an error??!?!?!
What does "pattern is empty" realy mean?
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlnsage="http://www.wolterinkwebdesign.com/xml/page"
xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent">
<xslutput method="xml" indent="yes"/>
<xslaram name="absolute_url"/>
<xslaram name="upload_url"/>
<!--
! Default template for an image
!
!-->
<xsl:template name="image">
<xslaram name="max_width" select="200"/>
<xslaram name="img"/>
<xsl:if test="$img[xc:width]">
<xsl:choose>
<xsl:when test="$img[xc:error]/">
<b><xsl:value-of select="$img/xc:error"/></b>
</xsl:when>
<xsltherwise>
<img>
<xsl:attribute name="src">
<xsl:value-of select="$upload_url"/>/<xsl:value-of select="current()"/>
</xsl:attribute>
<xsl:if test="$img/@width>$max_width">
<xsl:attribute name="width"><xsl:value-of select="$max_width"/></xsl:attribute>
</xsl:if>
</img>
</xsltherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<!--
! All html should remain html
!-->
<xsl:template match="*[namespace-uri(.) != namespace::xc]">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:apply-templates select="./node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
But now i get teh folowing error:
array(7) {
["msgtype"]=>
string(5) "error"
["code"]=>
string(2) "19"
["module"]=>
string(9) "Sablotron"
["URI"]=>
string(36) "file://C:/webserver/xsl/standard.xsl"
["line"]=>
string(2) "22"
["node"]=>
string(20) "element ''"
["msg"]=>
string(16) "pattern is empty"
}
So on line 22:
line 22: <xsl:when test="$img[xc:error]/">
the patternt is empty.
But $img should be a variable to a node, i tried <xsl:when test="current()[xc:error]/">
But that does not work.
What i want to do is call the template with name "image" whenever some element is found,
i give that element as an param $img with the template named "image".
But my xsl file that the above xsl includes do not ever call the template named "image".
So why is there an error??!?!?!
What does "pattern is empty" realy mean?