I have the following XML document:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<common>
<text>First Line</text>
<insert pl="1"/>
<text>Second Line</text>
<insert pl="2"/>
</common>
<particular>
<insert_text num="1">First Insert</insert_text>
<insert_text num="2">Second Insert</insert_text>
</particular>
</document>
and the following XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<BODY>
<xsl:apply-templates select="/document/common/*"/>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="text">
<P>
<xsl:apply-templates/>
</P>
</xsl:template>
<xsl:template match="insert">
<P>
<xsl:value-of
select="/document/particular/insert_text[@num='{./@pl}']"/>
</P>
</xsl:template>
</xsl:stylesheet>
The output isn't:
<HTML>
<BODY>
<P>
First Line
</P>
<P>
First Insert
</P>
<P>
Second Line
</P>
<P>
Second Insert
</P>
</BODY>
</HTML>
but:
<HTML>
<BODY>
<P>
First Line
</P>
<P/>
<P>
Second Line
</P>
<P/>
</BODY>
</HTML>
Is there a method to obtian the wanted HTML document ?
Greetings, bye.