Subject: getting element name into html using MSXML3 From: "Will Fraser" <wfraser@xxxxxxx> Date: Mon, 22 May 2000 21:59:00 -0400 |
Hello, I havne't seen this question asked in the few weeks I have been on the list. I am hoping someone can help. I am using ie5 to aprse my documents, and I have installed the May Preview Release of XSL from MS. I presume this means that my ie5 now parses with the updated engine. I am trying to output the name of the element in order to serve as a header for the value of the element. Currently it outputs the following HTML: <html> <head> <title>Today's News</title> <link href="default.css" rel="STYLESHEET" type="text/css" /> </head> <body> <table align="center" bgcolor="#808080" cellspacing="2" cellpadding="2" border="1"> <tr> <td> <div class="right"> Mon May 22, 2000 </div> </td> </tr> <tr> <td> <div class="center"> News headline of day Headlines </div> </td> </tr> <tr> <td> News headline of day </td> </tr> <tr> <td> <div class="center"> finance headline Headlines </div> </td> </tr> <tr> <td> finance headline </td> </tr> </table> </body> </html> Obviously the problem is that it outputs the value of the children of content instead of their names. The problem is, of course, in the <xsl:value-of> statement, but if I use 'select" MS balks at any name() or similar methods. Using "test" I get wrong result. Many thanks for any assistance. Will Following is the XML: <?xml version='1.0'?> <?xml:stylesheet type='text/xsl' href='../news.xsl'?> <content> <date> Mon May 22, 2000 </date> <news> News headline of day </news> <finance> finance headline </finance> </content> Here is the XSL: <xsl:template match="/"> <html> <head> <title>Today's News</title> <link href="default.css" rel="STYLESHEET" type="text/css"/> </head> <body> <table align="center" bgcolor="#808080" cellspacing="2" cellpadding="2" border="1"> <tr> <td> <div class="right"> <xsl:value-of select="/content/date"/> </div> </td> </tr> <xsl:apply-templates/> </table> </body> </html> </xsl:template> <xsl:template match="/content"> <xsl:apply-templates/> </xsl:template> <xsl:template match="/content/*[index() > 0] "> <tr> <td> <div class="center"> <xsl:value-of test="local-name(this)"/> Headlines </div> </td> </tr> <tr> <td> <xsl:value-of select="."/> </td> </tr> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: ANN: Evaluation Version of Rend, Sebastian Rahtz | Thread | Re: getting element name into html , Dan Morrison |
RE: xsl:extension-element-prefixes, Andrew Kimball | Date | Re: Mozilla. Re: Netscape Support f, Paul Tchistopolskii |
Month |