我要做的是在call-template:SpecialRadio
元素上使用Radio
,循环遍历每个元素,按位置提取数据,然后对它们执行XSLT。出于某种原因,单选按钮显示,但Caption
的{{1}}数据未显示,即“Postanschrift”和“SMS / MMS”。我的XSL在哪里出错?
鉴于jsp-include.xsl
StaticLabel
鉴于Main.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>
给定XML
<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>
使用Altova生成的XSLT
<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>
答案 0 :(得分:1)
不应该这样 -
<xsl:copy-of select="$radioLabel[position()=$i]/Caption"/>
因为Caption是一个元素,而不是一个属性?