Subject: [xsl] Accessing Global Parameters from an included Stylesheet From: "Todd Baker" <lists@xxxxxxxxxxxxxxxxx> Date: Mon, 19 Jan 2004 15:09:48 +1100 |
Hi All, I am getting some weird behaviour in the parsing of my XSLT stylesheets in the MSXML 4(SP2) parser and would like to ask the list if its me or the parser at fault. I have one main .xsl that is loaded into the MSXML parser and from there I load an "included" stylesheet with some named templates as shown below. << MAIN TEMPLATE >> ____________________________________________________________________________ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="http://www.lateralsystems.com/user" xmlns:vbuser="http://www.lateralsystems.com/vbuser" version="1.0" exclude-result-prefixes="msxsl user vbuser"> <xsl:include href="nswTemplates.xsl"/> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /> <xsl:strip-space elements="*"/> <xsl:template match="html"> <xsl:copy-of select="*|text()"/> </xsl:template> <xsl:param name="id"></xsl:param> <xsl:param name="query_news"></xsl:param> <xsl:param name="stateFolder">new_south_wales</xsl:param> <xsl:param name="statePagesFolder">nsw_pages</xsl:param> <xsl:param name="stateLibraryFolder">nsw_library</xsl:param> <xsl:template match="/"> <!-- Lots of stuff in here deleted --> <xsl:call-template name="LatestNews" /> </xsl:template> </xsl:stylesheet> << nswTemplates.xsl >> ____________________________________________________________________________ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="http://www.lateralsystems.com/user" xmlns:vbuser="http://www.lateralsystems.com/vbuser" version="1.0" exclude-result-prefixes="msxsl user vbuser"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /> <xsl:strip-space elements="*"/> <xsl:template name="LatestNews"> <h1>Latest News</h1> <xsl:for-each select="/content/assets/group[@name='states']/group[@name=$stateFolder]/grou p[@name=$stateLibraryFolder]//asset[@assetdefname='state news']/version"> <xsl:sort select="element_priority_news" order="descending"/> <xsl:sort select="element_date/@datesort" order="descending" /> <xsl:sort select="element_time/@timesort" order="descending" /> <!-- BLAH BLAH BLAH, Do this and that, maybee some more... --> </xsl:for-each> </xsl:template> </xsl:stylesheet> ____________________________________________________________________________ As you can see I am using the $stateFolder and $stateLibraryFolder parameters from the main stylesheet to evaluate my XPATH, the problem is, whilst I CAN ACCESS $stateFolder I CANNOT access $stateLibraryFolder. I get an error: "A reference to variable or parameter 'stateLibraryFolder' cannot be resolved. The variable or parameter may not be defined, or it may not be in scope. " If I then define this parameter in nswTemplates.xsl I get this error: "Global variable or parameter 'stateLibraryFolder' cannot be defined more than once with the same import precedence." Which is what I was expecting... The "LatestNews" template runs fine if I move the code into the main template. My question is, should I be able to access these parameters or should I be parsing these into each template using with-param OR is this a MSXML bug? Thanks in advance. Todd XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Emacs, nxml, xslt-process and, Gary Cornelius | Thread | Re: [xsl] Accessing Global Paramete, S.Murali Krishna |
RE: [xsl] encoding <-> omit-xml-dec, Michael Kay | Date | Re: [xsl] encoding <-> omit-xml-dec, Stan Devitt |
Month |