用于创建XML模式定义的XSLT样式表

用于创建XML模式定义的XSLT样式表,xslt,xsd,Xslt,Xsd,我的输入数据如下所示: <?xml version="1.0" encoding="UTF-8"?> <ns1:queryResponse xmlns:ns1="http://abc.com/"> <ns1:result> <ns1:records xmlns:ns2="http://def.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:Ac

我的输入数据如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<ns1:queryResponse xmlns:ns1="http://abc.com/">
  <ns1:result>
    <ns1:records xmlns:ns2="http://def.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:Account">
      <ns2:Id>2c</ns2:Id>
      <ns2:Number>A722</ns2:AccountNumber>
    </ns1:records>
  </ns1:result>
</ns1:queryResponse>

2c
A722
我需要编写一个样式表来创建以下格式的XML:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:complexType name="Account">
    <xsd:sequence>
      <xsd:element minOccurs="0" name="Id" type="xsd:string"/>
      <xsd:element minOccurs="0" name="Number" type="xsd:string">
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

样式表应该能够创建这个XML吗


字段也在动态变化,因此样式表必须是通用的,以便从XML中提取元素名称和值并创建输出XML。

您想要实现什么?是否要基于输入XML创建XSD?在这种情况下,是否要为具有子元素的元素创建架构?这已经得到了回答。我想创建一个遵循该架构的xml。它的格式应该是“xsi:type=“Account”>12 22