开发者

dtd #PCDATA for child nodes in xml

I have a few child nodes that repeat. How do I create an internal DTD namespace to make f1 and f2 use #PCDATA?

<xsl:for-each select="a/b/c/d/e[1]/f">
        <tr>
          <td><xsl:value-of select="f1"></td>       
          <td><xsl:value-of select="f2">/td> 
          <td>
</xsl:for-each>
<xsl:for-each select="a/b/c/d/e[2]/f">
        <tr>
          <td><xsl:value-of select="f1"></td>       
          <td><xsl:value-of select="f2">/td> 
          <td>
</xsl:for-each>

XML:

<a>
<b>
<c>
<d>
<e section="1">
<f>
<f1></f1><f2></f2>
</f>
</e>
<e section="2"&g开发者_Go百科t;
<f>
<f1></f1><f2></f2>
</f>
</e>
</d>
</c>
</b>
</a>

How do I create an internal DTD namespace to make f1 and f2 use #PCDATA?


Appropriate DTD:

<!DOCTYPE a [

    <!ELEMENT a (b)>
    <!ELEMENT b (c)>
    <!ELEMENT c (d)>
    <!ELEMENT d (e*)>
    <!ELEMENT e (f)>
    <!ELEMENT f (f1, f2)>
    <!ELEMENT f1 (#PCDATA)>
    <!ELEMENT f2 (#PCDATA)>

    <!ATTLIST e section CDATA #REQUIRED>

]>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜