2015-06-15 62 views
0

下面是我的xslt,基本上有嵌套複雜類型。複雜類型與序列排列

<xs:complexType name="onlineExpressRemitService"> 
       <xs:sequence> 
        <xs:element minOccurs="0" name="return" type="tns:onlineExpressRemitResponse"/> 
       </xs:sequence> 
      </xs:complexType> 
      <xs:complexType name="onlineExpressRemitResponse"> 

       <xs:complexContent>    
        <xs:extension base="tns:endpointResponse"> 
         <xs:sequence> 
          <xs:element minOccurs="0" name="description" type="xs:string"/> 
          <xs:element minOccurs="0" name="hostResponseCode" type="xs:string"/> 
         </xs:sequence> 
        </xs:extension> 
       </xs:complexContent> 
      </xs:complexType> 


<xs:complexType name="endpointResponse"> 
       <xs:sequence> 

        <xs:element minOccurs="0" name="response" type="tns:endpointResponseHeader"/> 
       </xs:sequence> 
      </xs:complexType> 

      <xs:complexType name="endpointResponseHeader"> 
       <xs:sequence> 

        <xs:element minOccurs="0" name="requesttimestamp" type="xs:string"/> 
        <xs:element minOccurs="0" name="responsetimestamp" type="xs:string"/> 
        <xs:element name="statuscode" type="xs:int"/> 

       </xs:sequence> 
      </xs:complexType> 

我輸入XML

<return> 


       <response> 
        <requesttimestamp>2015-05-18t11:20:40.201+0800</requesttimestamp> 
        <responsetimestamp>2015-05-18t11:20:40.218+0800</responsetimestamp> 
        <statuscode>1</statuscode> 
       </response> 
       <description>Successful</description> 
       <hostResponseCode>000</hostResponseCode> 
      </return> 

有我的XML輸入沒有錯誤,但是這不是我想要的,我期望的輸入是描述標籤和hostresponsecode標籤位於上面的響應標籤

<return> 

    <description>Successful</description> 
    <hostResponseCode>000</hostResponseCode> 
    <response> 
     <requesttimestamp>2015-05-18t11:20:40.201+0800</requesttimestamp> 
     <responsetimestamp>2015-05-18t11:20:40.218+0800</responsetimestamp> 
     <statuscode>1</statuscode> 
    </response> 

</return> 

我確實嘗試過嵌套複雜類型,嵌套序列,但是這不是在所有的工作。我迷失在瞬間,需要一些指導,請讓我知道如果有任何其他信息是需要。

+1

我無法確定你的問題是什麼。你說「*下面是我的xslt *」,但你向我們展示了一個模式。你說「*這根本不起作用」,但你不會說你想做什麼。 –

回答

0

當您通過擴展定義從另一個派生的一個複雜類型時,附加元素只能在最後進行。因此,如果您想支持您所描述的內容模型,則無法通過以這種方式擴展基本複雜類型來實現。