This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: generating text from an attribute


<xsl:template match="CHILD">
  <p>My name is <xsl:value-of select="@name">. I am <xsl:value-of
select="@age".</p>
</xsl:template>

Here is the complete stylesheet.

<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0"
>

<xsl:template match="/">
  <html>
    <head>
      <title>People Stuff</title>
    </head>
    <body>
      <xsl:apply-templates select="ROOT"/>
    </body>
  </html>
</xsl:template>

<xsl:template match="ROOT">  
  <h1>Hello</h1>
  <xsl:apply-templates select="PARENT"/>
</xsl:template>

<xsl:template match="PARENT">  
  <h1>Hello</h1>
  <xsl:apply-templates select="CHILD"/>
</xsl:template>

<xsl:template match="CHILD">
  <p>My name is <xsl:value-of select="@name"/>. I am <xsl:value-of
select="@age"/>.</p>
</xsl:template>

</xsl:stylesheet>

-----Original Message-----
From: Foster, Justin (IT_Architecture) [mailto:JFoster@russell.com]
Sent: Monday, July 17, 2000 4:24 PM
To: 'xsl-list@mulberrytech.com'
Subject: generating text from an attribute


Here's a newbie question.

How do I generate the value of a attribute as text:

i.e.

<ROOT>
	<PARENT>
		<CHILD name="Bob" age="20"/>
	</PARENT>
</ROOT>


I want to output to html:

<HTML>
<HEAD>
</HEAD>
<BODY>
My name is Bob.  I am 20 years old.</BODY>
</HTML>


Justin Foster 
IT Architecture
253-596-3260 office
253-223-3108 mobile


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]