【发布时间】:2015-04-18 06:15:22
【问题描述】:
我有以下 XML 输入:
<?xml version="1.0" encoding="utf-8"?>
<update-all-attributes>
<document name="http://www.threadless.com/product/8/Ctrl_Z">
<attribute name="PageType" value="product" />
<attribute name="ProductId" value="8" />
<attribute name="Title" value="Ctrl + Z"></attribute>
</document>
如何编写 XSLT 查询以将其转换为下面的 XML,我在其中解析属性名称并从中创建标签?
<?xml version="1.0" encoding="utf-8"?>
<update-all-attributes>
<document name="http://www.threadless.com/product/8/Ctrl_Z">
<PageType>product</PageType>
<ProductId>8</ProductId>
<Title>Ctrl + Z</Title>
</document>
【问题讨论】:
-
只有当
name属性的值始终是有效的元素名称时,您的要求才是可能的。
标签: xml xslt xpath xml-parsing