[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Elements with Mixed contents
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 Datamatics Technologies Limited Ph: 91-022-8290829 ( Ext: 617 ) SDF IV, SEEPZ, Mumbai-400 096, INDIA. Email: 2dsan@xxxxxxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|