我要做的是在一个call-template:SpecialRadio元素上使用Radio,方法是循环遍历每个元素,按位置提取数据,然后对它们执行XSLT。由于某种原因,会显示单选按钮,但StaticLabel的StaticLabel数据没有显示,即“后裂痕”和“SMS/MMS”。我的XSL哪里出错了?
给出jsp-include.xsl de.xsl
<xsl:template name="SpecialRadio">
<xsl:param name="name"/>
<xsl:param name="map"/>
<xsl:param name="radio"/>
<xsl:param name="radioStyle"/>
<xsl:param name="radioLabel"/>
<xsl:param name="i"/>
<StaticLabel>
<xsl:attribute name="style">
<xsl:copy-of select="$radioStyle[position()=$i]/@style"/>
<xsl:text>; margin-left:500px</xsl:text>
</xsl:attribute>
<xsl:copy-of select="$radioLabel[position()=$i]/@Caption"/>
</StaticLabel>
<Radio>
<ReadOnly>false</ReadOnly>
<Map rtexprvalue="true">mb.getLookup("YES_NO")</Map>
<Name rtexprvalue="true"><xsl:value-of select="$radio/Name"/></Name>
<Default rtexprvalue="true">mb.getValue("<xsl:value-of select="Name"/>")/Default>
</Radio>
</xsl:template>给Main.xsl
<div id="head">
<xsl:call-template name="JspInclude">
<xsl:with-param name="flush" select="'true'"/>
<xsl:with-param name="file" select="'Header_1_D.jsp'"/>
</xsl:call-template>
<xsl:for-each select="$radio[position() <= 4]">
<xsl:call-template name="SpecialRadio">
<xsl:with-param name="i" select="position()"/>
<xsl:with-param name="name" select="FieldList[@group='2']/Radio/Name"/>
<xsl:with-param name="map" select="FieldList[@group='2']/Radio/Map"/>
<xsl:with-param name="radio" select="FieldList[@group='2']/Radio"/>
<xsl:with-param name="radioStyle" select="FieldList[@group='2']/StaticLabel"/>
<xsl:with-param name="radioLabel" select="FieldList[@group='2']/StaticLabel"/>
</xsl:call-template>
提供的XML
<FieldList group="2">
<StaticLabel style="font-family:Arial;color:#330000;font-size:9pt">
<Caption><![CDATA[Postanschrift]]></Caption>
<Name><![CDATA[APPLICATION_CUSTOMER.APPLICATION_TYPE]]></Name>
</StaticLabel>
<Radio>
<EntityID><![CDATA[6100]]></EntityID>
<Name><![CDATA[APPLICATION_CUSTOMER.APPLICATION_TYPE]]></Name>
<FieldType><![CDATA[]]></FieldType>
<Default rtexprvalue="true"><![CDATA[mb.getValue("APPLICATION_CUSTOMER.APPLICATION_TYPE", "")]]></Default>
<Map rtexprvalue="true"><![CDATA[mb.getLookup("YES_NO", "CODE", "NAME", "EN", false,"")]]></Map>
<ReadOnly rtexprvalue="true"><![CDATA[mb.isReadonly(2)]]></ReadOnly>
<AccessType><![CDATA[2]]></AccessType>
<SearchMatchFlag><![CDATA[]]></SearchMatchFlag>
<InvalidatePlanFlag><![CDATA[false]]></InvalidatePlanFlag>
</Radio>
<StaticLabel style="font-family:Arial;color:#330000;font-size:9pt">
<Caption><![CDATA[SMS / MMS]]></Caption>
<Name><![CDATA[APPLICATION_CUSTOMER.APPLICATION_TYPE]]></Name>
</StaticLabel>
<Radio>
<EntityID><![CDATA[6101]]></EntityID>
<Name><![CDATA[APPLICATION_CUSTOMER.APPLICATION_TYPE]]></Name>
<FieldType><![CDATA[]]></FieldType>
<Default rtexprvalue="true"><![CDATA[mb.getValue("APPLICATION_CUSTOMER.APPLICATION_TYPE", "")]]></Default>
<Map rtexprvalue="true"><![CDATA[mb.getLookup("YES_NO", "CODE", "NAME", "EN", false,"")]]></Map>
<ReadOnly rtexprvalue="true"><![CDATA[mb.isReadonly(2)]]></ReadOnly>
<AccessType><![CDATA[2]]></AccessType>
<SearchMatchFlag><![CDATA[]]></SearchMatchFlag>
<InvalidatePlanFlag><![CDATA[false]]></InvalidatePlanFlag>
</Radio>
</FieldList>使用Altova生成XSLT
<div id="head">
<HtmlCode xmlns:jsp="http://www.microforum.com/calms/tags/jsptag-1">
<jsp:include flush="true" page="Header_1_D.jsp"/>
</HtmlCode>
<StaticLabel xmlns:jsp="http://www.microforum.com/calms/tags/jsptag-1" style="; margin-left:500px"/>
<Radio xmlns:jsp="http://www.microforum.com/calms/tags/jsptag-1">
<ReadOnly>false</ReadOnly>
<Map rtexprvalue="true">mb.getLookup("YES_NO")</Map>
<Name rtexprvalue="true"/>
<Default rtexprvalue="true">mb.getValue("APPLICATION_CUSTOMER.APPLICATION_TYPE")</Default>
</Radio>
<StaticLabel xmlns:jsp="http://www.microforum.com/calms/tags/jsptag-1" style="; margin-left:500px"/>
<Radio xmlns:jsp="http://www.microforum.com/calms/tags/jsptag-1">
<ReadOnly>false</ReadOnly>
<Map rtexprvalue="true">mb.getLookup("YES_NO")</Map>
<Name rtexprvalue="true"/>
<Default rtexprvalue="true">mb.getValue("APPLICATION_CUSTOMER.APPLICATION_TYPE")</Default>
</Radio>
<HtmlCode>
<br/>
<br/>
<br/>
</HtmlCode>
</div>发布于 2012-09-06 22:21:19
是不是应该沿着这条路走-
<xsl:copy-of select="$radioLabel[position()=$i]/Caption"/>既然标题是一个元素而不是一个属性?
https://stackoverflow.com/questions/12308073
复制相似问题