Subject: [xsl] Mixed Contents From: "Sandeep Deshpande" <2dsan@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 12 Feb 2004 11:15:52 +0530 |
Hi All, I have a problem with the elements having mixed content. The problem is as follows. ======= XML File (x.xml ) ================ <?xml-stylesheet type="text/xsl" href="x.xsl"?> <directory>Hi I am in a directory. <subdirectory>Hi I am in a subdirectory. <file>Hi I am in file1.</file> in between two files (back to subdirectory.) <file>Hi I am in file2.</file> in between two files (back to subdirectory.) <file>Hi I am in file3.</file> out of file. back to subdirectory.</subdirectory> out of subdirectory. back to directory.</directory> ================================ ======= XSL File (x.xsl ) ================ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html><body> <xsl:apply-templates/> </body></html> </xsl:template> <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> <xsl:template match="subdirectory"> <font color="red"> <br/><xsl:value-of select="text()"/><br/> <xsl:apply-templates select="file"/> <br/><xsl:value-of select="text()[1]"/><br/> <br/><xsl:value-of select="text()[2]"/><br/> </font> </xsl:template> <xsl:template match="file"> <font color="blue"> <br/><xsl:value-of select="."/></font><br/> </xsl:template> </xsl:stylesheet> ==================================== ======= Expected output ================ Hi I am in a directory. Hi I am in a subdirectory. Hi I am in file1. in between two files (back to subdirectory.) Hi I am in file2. in between two files (back to subdirectory.) Hi I am in file3. out of file. back to subdirectory. out of subdirectory. back to directory. ==================================== ======= ACTUAL OUTPUT ON IE5 ================ Hi I am in a directory. Hi I am in a subdirectory. Hi I am in file1. Hi I am in file2. Hi I am in file3. in between two files (back to subdirectory.) in between two files (back to subdirectory.) out of subdirectory. back to directory. ==================================== My problems :- 1) I can not place the data occurring between two child elemet properly. For e.g. in between two files (back to subdirectory.) ). 2) I have to keep a counter in XSL, for the data patches of the parent element occurring in between the child elements. ( For e.g. <br/><xsl:value-of select="text()[2]"/><br/> ). In big size data it is impossible to know how many data patches occur in between the child elements. If any of the gurus could get the solution of any of these problems, I would be grateful. Thanks & Regards Sandeep Deshpande XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Combining cross-reference, Paul DuBois | Thread | Re: [xsl] Mixed Contents, J.Pietschmann |
Re: [xsl] Combining cross-reference, Paul DuBois | Date | [xsl] Problems with XALAN :Extra il, Satish Terala |
Month |