This message was edited by iDaZe at 2003-2-5 7:38:8
: Hi.
:
: When I try to view my para.xml file with the XSL stylesheet with IE5, I get something like
:
: 1st title
:
: 2nd title
:
: 1st paragraph
:
: 2nd paragraph
:
: This format is not desirable. What I want is to get the 1st title and then the 1st paragraph, and only after that the 2nd title and the 2nd paragraph.
:
: Does any one know how to do this only by modifying the XSL stylesheet?
:
: Here are the files:
:
: -------------------
: para.xml file:
:
: <?xml-stylesheet type="text/xsl" href="para.xsl"?>
: <document>
: <ptitle>1st title</ptitle>
: <text>1st paragraph</text>
: <ptitle>2nd title</ptitle>
: <text>2nd paragraph</text>
: </document>
:
: -------------------
: para.xsl file:
:
: <?xml version="1.0"?>
: <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
: <xsl:template match="/">
: <HTML>
: <BODY>
: <xsl:for-each select="document">
:
: <xsl:for-each select="ptitle">
: <p><b><xsl:value-of select="text()"/></b></p>
: </xsl:for-each>
:
: <xsl:for-each select="text">
: <p><xsl:value-of select="text()"/></p>
: </xsl:for-each>
: </xsl:for-each>
: </BODY>
: </HTML>
: </xsl:template>
:
: </xsl:stylesheet>
:
I'm not really much of an expert on xml (only read a few tutorials and don't really use it much), but I don't think it can be done that easily.
It would be easier if you edit both documents:
<?xml-stylesheet type="text/xsl" href="para.xsl"?>
<document>
<paragraph>
<ptitle>1st title</ptitle>
<text>1st paragraph</text>
</paragraph>
<paragraph>
<ptitle>2nd title</ptitle>
<text>2nd paragraph</text>
</paragraph>
</document>
and
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<xsl:for-each select="document/paragraph">
<p><b><xsl:value-of select="ptitle"/></b></p>
<p><xsl:value-of select="text"/></p>
</xsl:for-each>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>