2011-08-12 5 views
0

XSLTにXSLFOを入力してXML文書を作成しましたが、それはすべて正常に動作し、素敵なフォーマットのpdfを生成します。私が書いたスキーマは、構造がプロジェクトのナブであるため、問題を引き起こしています。Schema newbie - 1週間以上立ち往生

XMLドキュメントの例:

<sect> 
    <summ> 
     <p> 
     Here's some text. 
     </p> 
     <img src="www.someaddress.com"/> 
     <p> 
     Here's more text. 
     </p> 
    </summ> 
<sect> 

に対応するスキーマの(スペースを節約するために、私は、xsのそれぞれからのいくつかの要素を削除した:選択の):

<xs:element name="img"> 
    <xs:complexType> 
     <xs:attribute name="src" type="xs:string" use="required"/> 
    </xs:complexType> 
</xs:element> 

<xs:element name="summ"> 
    <xs:complexType> 
     <xs:choice> 
      <xs:element maxOccurs="unbounded" ref="p"/> 
      <xs:choice minOccurs="0" maxOccurs="unbounded"> 
       <xs:element ref="img"/> 
      </xs:choice> 
     </xs:choice> 
     <xs:attribute name="title"/> 
    </xs:complexType> 
</xs:element> 

<xs:element name="sect"> 
    <xs:complexType mixed="true">   
     <xs:choice maxOccurs="unbounded"> 
      <xs:element ref="summ"/> 
     </xs:choice> 
    </xs:complexType> 
</xs:element> 

<xs:element name="p"> 
    <xs:complexType mixed="true"> 
     <xs:choice minOccurs="0" maxOccurs="unbounded"> 
      <xs:element ref="img"/> 
     </xs:choice> 
    </xs:complexType> 
</xs:element> 

私は許すことができるようにしたいです"p"の内側と外側の両方に現れるようにするには、スキーマに対してこれを検証した時点で、 "cvc-complex-type.2.4.a:要素 'img'で始まる無効な内容が見つかりました。 '{p}'が期待されます。

だから、理想的に、私は以下が有効になりたいと思います:

<sect> 
    <summ> 
     <p> 
     Here's some text. 
     </p> 
     <img src="www.someaddress.com"/> 
     <p> 
     <img src="www.someotheraddress.com"/> 
     </p> 
    </summ> 
<sect> 

あなたは、私は非常に感謝されると思います助けることができる場合:)

答えて

0
<xs:element name="summ"> 
<xs:complexType> 
    <xs:choice minOccurs="1" maxOccurs="unbounded"> 
     <xs:element minOccurs="1" ref="p"/> 
     <xs:element ref="img"/> 
    </xs:choice> 
    <xs:attribute name="title"/> 
</xs:complexType> 

関連する問題