0
原始XML:如何在元素名称下显示特定元素的所有值?
<section sectiontype="WITNESSES">
<bodytext>
<p>
<text>
<person:person>
<person:name.text>NEIL CAVUTO, FBN ANCHOR</person:name.text>
</person:person>
</text>
</p>
<p>
<text>
<person:person>
<person:name.text>REP. BARNEY FRANK, D-MASS.</person:name.text>
</person:person>
</text>
</p>
</bodytext>
</section>
XSL模板,我有:
<xsl:template match="base:section[@sectiontype='WITNESSES']/base:bodytext/base:p">
<xsl:element name="nl"/>
<xsl:element name="{name()}">
<xsl:copy-of select="@*"/>
<xsl:attribute name="display">block</xsl:attribute>
<xsl:element name="hdr">
<xsl:attribute name="typestyle">BF</xsl:attribute>
<xsl:attribute name="inline">Y</xsl:attribute>
<xsl:text>WITNESSES:</xsl:text>
<xsl:apply-templates/>
</xsl:element>
</xsl:element>
</xsl:template>
电流输出我得到:
目击者:尼尔·卡维托,FBN锚
目击者:REP。 BARNEY FRANK,D-MASS。
所需的输出:
证人:
尼尔·卡维托,FBN ANCHOR
REP。 BARNEY FRANK,D-MASS。
它的工作太棒了!谢谢。 但我希望的输出是: WITNESSES: NEIL CAVUTO,FBN ANCHOR REP。 BARNEY FRANK,D-MASS。 而我得到的是: WITNESSES:NEIL CAVUTO,FBN ANCHOR REP。 BARNEY FRANK,D-MASS。 –
@JohhnDev,你想要的和观察到的输出之间没有任何区别。无论如何,XSLT之外的因素会影响您的结果在各种媒体中的呈现方式。既然你没有公开演示媒体或过程,我只能解释原则。你必须弄清楚你需要从你的转换中得到什么*** XML ***输出,并应用我提供的信息来生成这些信息。 –