[Home] [By Thread] [By Date] [Recent Entries]
Sandeep Deshpande wrote:
Hi All, I have a problem with the elements having mixed content. The problem is as follows. ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Fix this first, according to the hint in the other post. Actually, the rest of the code you provided is standard XSLT rather that WD-XSL. ... <xsl:template match="directory"> <br/><xsl:value-of select="text()"/><br/> <xsl:apply-templates select="subdirectory"/> <br/><xsl:value-of select="text()[1]"/><br/> </xsl:template>
The following will be closer to your requirements: <xsl:stylesheet version="1.0"
"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html><head><title/</head>><body>
<xsl:apply-templates/>
</body></html>
</xsl:template>
<xsl:template match="directory">
<xsl:apply-templates/>
<br/>
</xsl:template>
<xsl:template match="subdirectory">
<font color="red">
<xsl:apply-templates/>
</font><br/>
</xsl:template>
<xsl:template match="file">
<font color="blue">
<xsl:apply-templates/>
</font><br/>
</xsl:template>
</xsl:stylesheet>This will omit some line breaks. Adding the following template
<xsl:template match="text()">
<xsl:apply-templates/><br/>
</xsl:template>
will probably fix this for your sample code but may have unexpected
side effects in more general cases.J.Pietschmann XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



