[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

getting element name into html using MSXML3

Subject: getting element name into html using MSXML3
From: "Will Fraser" <wfraser@xxxxxxx>
Date: Mon, 22 May 2000 21:59:00 -0400
xsl getting element name
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.