以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  请教  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=14599)


--  作者:lifangde125
--  发布时间:2/19/2005 4:53:00 AM

--  请教
schema Quellecode:
<xsd:complexType name="dataType">
   <xsd:choice>
 <xsd:element name="BOOL"/>
 <xsd:element name="BYTE"/>
 <xsd:element name="WORD"/>
 <xsd:element name="DWORD"/>
 <xsd:element name="LWORD"/>
 <xsd:element name="INT"/>
 <xsd:element name="DINT"/>
 <xsd:element name="LINT"/>
    </xsd:choice>
</xsd:complexType>
<xsd:complexType name="interface">
  <xsd:element name="globaleVars">
     <xsd:complexType>
       <xsd:complexContent>
         <xsd:extension base="ppx:varList">
       </xsd:complexContent>
    </xsd:complexType>
  </xsd:element> 
</xsd:complexType>
<xsd:complexType name="varList">
  <xsd:choice minOccurs="0" maxOccurs="unbounded">
    <xsd:element name="variable">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="type" type="ppx:dataType"/><!-- 这里不是attribute"type" in element "type" 吗?-->          <xsd:element name="initialValue" type="ppx:value" minOccurs="0"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
  </xsd:choice>
</xsd:complexType>

在xslt中,
<interface>
  <globalVars>
    <xsl:for-each select="Foundation.Core.Classifier.feature/Foundation.Core.Attribute">
      <variable>     
        <xsl:if test="Foundation.Core.StructuralFeature.type/Foundation.Core.DataType/@xmi.idref='eee_1045467100323_191782_59'"><!--这是BOOL的ID-->
            <type>
 <xsl:attribute name="type">BOOL</xsl:attribute>
            </type>
           </xsl:if>    
         </variable>
       </xsl:for-each>
     </globalVars>      
</interface>      
编译之后,我的新xml文件总有错"unexpected attribute 'type' in element 'type'",我不知道为什么? 
我不知道schema <xsd:choice>中的element应该怎么调用呢?我上面这样用对吗?         


--  作者:binaryluo
--  发布时间:2/19/2005 12:49:00 PM

--  
<xsd:element name="type" type="ppx:dataType"/><!-- 这里不是attribute"type" in element "type" 吗?-->

“xsd”的名字空间是什么啊?
声明子元素时应该用名字空间xmlns="urn:schemas-microsoft-com:xml-data"里的ElementType元素吧。


--  作者:lifangde125
--  发布时间:2/20/2005 5:45:00 AM

--  是这样的
其实
<xsl:attribute name="type"><BOOL/></xsl:attribute>
就可以了.我自己搞复杂了.
楼上的,谢谢.
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
1,137.695ms