[ http://issues.apache.org/jira/browse/XALANJ-1319?page=all ]
Brian Minchau updated XALANJ-1319: ---------------------------------- Version: Latest Development Code (was: 2.4) > Parameter value lost when traversing different context > ------------------------------------------------------ > > Key: XALANJ-1319 > URL: http://issues.apache.org/jira/browse/XALANJ-1319 > Project: XalanJ2 > Type: Bug > Components: Xalan > Versions: Latest Development Code > Environment: Operating System: Windows NT/2K > Platform: PC > Reporter: Peter Hunsberger > Assignee: Xalan Developers Mailing List > > input XML: > <?xml version="1.0" encoding="UTF-8"?> > <page type="menu"> > <menu> > <diagnosis type="Diagnosis" authorization="Read, Write, Update, Delete, > Control, Review, Lock, Admin" collection_id="44" screenName="diagnosis" > keyName="personId" parent_folder="false" from_data="true" title="Diagnosis"> > <diagnosisSite type="Diagnosis sites" authorization="Read, Write, Update, > Delete, Control, Review, Lock, Admin" collection_id="199" > screenName="diagnosis_site" keyName="diagnosisId" parent_folder="false" > from_data="false" title="Diagnosis sites"/> > </diagnosis> > </menu> > <root_keys> > <personId value="401250"/> > </root_keys> > <data> > <diagnosis> > <personId dataCollectionId="428" value="401250"/> > </diagnosis> > <diagnosisSite> > <diagnosisId dataCollectionId="442" value="428"/> > <diagnosisId dataCollectionId="441" value="428"/> > </diagnosisSite> > <diagnosis> > <personId dataCollectionId="434" value="401250"/> > </diagnosis> > <diagnosisSite> > <diagnosisId dataCollectionId="443" value="434"/> > </diagnosisSite> > </data> > </page> > input XSLT: > <?xml version='1.0' encoding='utf-8' ?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output encoding="utf-8" method="xml" indent="no"/> > <xsl:strip-space elements="*"/> > <xsl:template match="page"> > <xsl:copy> > <xsl:apply-templates select="*"/> > </xsl:copy> > </xsl:template> > <xsl:template match="menu"> > <xsl:variable name="nodename" select="local-name(*)"/> <!-- should > always have only one immeadiate child, local-name() picks first in any case > --> > <xsl:variable name="keyname" select="/page/data/*[local-name() = > $nodename]/*[1]"/> <!-- should be only one child... --> > <xsl:copy> > <xsl:apply-templates select="*" mode="submenu"> > <xsl:with-param name="parentKey" > select="/page/root_keys/*[local-name() = local-name($keyname)]/@value"/> > </xsl:apply-templates> > </xsl:copy> > </xsl:template> > <xsl:template match="*"> > <xsl:copy-of select="."/> > </xsl:template> > <xsl:template match="*" mode="menu"> > <xsl:param name="parentKey" select="."/> > <xsl:variable name="context" select="."/> > <xsl:copy> > <xsl:for-each select="/page/data/*[local-name() = local-name > ($context)]/*"> > <xsl:element name="{local-name($context)}"> > <xsl:if test="$context/*"> > <xsl:variable name="curKey" > select="current()/@dataCollectionId"/> > curKey=<xsl:value-of select="$curKey"/> > <xsl:apply-templates > select="$context/*" mode="submenu"> > <xsl:with-param > name="parentKey" select="$curKey"/> > </xsl:apply-templates> > </xsl:if> > </xsl:element> > </xsl:for-each> > </xsl:copy> > </xsl:template> > <xsl:template match="*" mode="submenu"> > <xsl:param name="parentKey"/> > parentKey=<xsl:value-of select="$parentKey"/> <!-- This value is lost with > Xalan 2.3.1 and above --> > <xsl:variable name="type"><xsl:value-of select="@type"/></xsl:variable> > <xsl:variable name="prev_type"><xsl:value-of select="preceding- > sibling::*[1]/@type"/></xsl:variable> > <xsl:apply-templates select="." mode="menu"> > <xsl:with-param name="parentKey" select="$parentKey"/> > </xsl:apply-templates> > </xsl:template> > </xsl:stylesheet> > Expected results properly output with Saxon, MSXML3, MSXML4. No "parentKey" > value output with Xalan 2.3.1 or 2.4.0. > Similar exists problem if using named templates, pass context as variable and > use a "for-each" to handle each item in turn. In this case, the variable is > ok > before the "for-each" and lost as soon as the "for-each" is entered. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]