我需要将以下XML转换为具有相同元素和属性的XML,但可以本地化的值(基本上是英语短语)除外。XSL仅用于将XML元素和属性值过滤出来?
一些元素(<footnote>
)和属性是可选的(<display_data_type>
),我希望能够做到这一般 - 没有每个元素的模板。那可能吗?
最终目标是能够将默认版本的XML与本地化版本进行比较,而忽略本地化字符串。
例如以下:
<data_schema>
<field symbol="ACCOUNT" type="string" name="Account Number">
<validators>
<maxlength>6</maxlength>
</validators>
<description>The account number</description>
<example>123456</example>
<default_value></default_value>
</field>
<field symbol="POSTAL_CODE" type="string" name="Postal Code">
<description>Postal Code for account</description>
<example>22022</example>
<footnote>Does not apply to certain accounts</footnote>
<default_value></default_value>
</field>
<field symbol="DISCOUNT" type="string" name="Discount Percentage" display_data_type="percentage">
<description>Descount determined by account</description>
<example>1.5%</example>
<default_value></default_value>
</field>
</data_schema>
将被转换成:
<data_schema>
<field symbol="ACCOUNT" type="string" name="">
<validators>
<maxlength>6</maxlength>
</validators>
<description/>
<example/>
<default_value/>
</field>
<field symbol="POSTAL_CODE" type="string" name="">
<description/>
<example/>
<footnote/>
<default_value/>
</field>
<field symbol="DISCOUNT" type="string" name="" display_data_type="percentage">
<description/>
<example/>
<default_value/>
</field>
</data_schema>
这对于本地化的问题没有关系。任何排除任何元素或属性的例子都是可以接受的。如果它确实很重要,则示例输入和输出指示哪些特定元素是可本地化的。 – Glenn