【发布时间】:2018-12-13 18:31:28
【问题描述】:
** 更新了输出 ** 我正在尝试将 Add CDATA to an xml file 但到目前为止似乎没有一个工作。 我什至尝试按字面意思添加它,但正如预期的那样,它没有成功。 任何人都可以在这方面帮助我。
这是我的节点的生成方式
<xsl:for-each select="$OLifE/">
<DataPoint>
<Name>Carrier.Requirements<xsl:if test="$NumberOfPayments > 1"><xsl:value-of select="position()"/></xsl:if></Name>
<Value>Here is the response text</Value>
</DataPoint>
我的预期输出是
<DataPoint>
<Name>Carrier.Requirements1</Name>
<Value><![CDATA[Here is the response text]]</Value>
</DataPoint>
<DataPoint>
<Name>Carrier.Requirements2</Name>
<Value><![CDATA[Here is the response text]]</Value>
</DataPoint>
<DataPoint>
<Name>Carrier.Requirements3</Name>
<Value><![CDATA[Here is the response text]]</Value>
</DataPoint>
如果需要任何进一步的信息,请告诉我。
【问题讨论】:
-
请提供minimal reproducible example,包括输入和预期输出。
-
仍然没有输入。而且您的预期输出没有任何 CDATA - 所以不清楚您的问题是什么。
-
@michael.hor257k:当你说输入时,你是什么意思?我认为输入是来自第一个代码部分中循环的值。
-
XSLT 的输入是一个 XML 文档。