agumiya Posted September 30, 2013 Share Posted September 30, 2013 Hello ! Hope someone could help me with this one. I accidently wrote this code: <select name="TYPE" id="TYPE" > <xsl:apply-templates select="TYPE-OPTION" /> <!-- The '/' closed the tag too early --> <xsl:with-param name="Slctd" select="normalize-space(TYPE-SELECTED)" /> <!--The with-param became worthless--></select> It was suppose to be like this : <select name="TYPE" id="TYPE" > <xsl:apply-templates select="TYPE-OPTION"> <xsl:with-param name="Slctd" select="normalize-space(TYPE-SELECTED)" /> </xsl:apply-templates> <!-- now the with-param is doing something --></select> As you can see in the first part, I accidently closed the xsl:apply-templates tag too early with / , making the with-param completely useless. This caused a bug. Is this code legal ? Is there a way or a product which could warn me about this kind of mistakes ? TNX Agumiya Link to comment Share on other sites More sharing options...
Martin Honnen Posted September 30, 2013 Share Posted September 30, 2013 When compiling your stylesheet, your XSLT processor should tell you that the `xsl:with-param` is not allowed where you put it. For instance with <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="root"> <xsl:apply-templates select="foo"/> <xsl:with-param name="p" select="1"/></xsl:template></xsl:stylesheet> Saxon 6.5.5 tells me Error at xsl:with-param on line 7 of file:/C:/Users/Foo/Bar/sheet.xsl xsl:with-param cannot appear as a child of xsl:template 1 Link to comment Share on other sites More sharing options...
agumiya Posted September 30, 2013 Author Share Posted September 30, 2013 When compiling your stylesheet, your XSLT processor should tell you that the `xsl:with-param` is not allowed where you put it. For instance with <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="root"> <xsl:apply-templates select="foo"/> <xsl:with-param name="p" select="1"/></xsl:template></xsl:stylesheet> Saxon 6.5.5 tells me Error at xsl:with-param on line 7 of file:/C:/Users/Foo/Bar/sheet.xsl xsl:with-param cannot appear as a child of xsl:template Thank you Martin ! I`ll check into it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now