SunQuest
           XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old June 18th, 2003, 02:18 PM
claustrophonic claustrophonic is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Nottingham, UK
Posts: 3 claustrophonic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
xsl:value-of not working!

I'm trying to retrieve some XML content inside a <xsl:for-each> loop using <xsl:value-of>. Here is the XSL code, followed by the XML code being processed. The value that does not display is the contents of <skill>:
-----
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" version="1.0">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="resume">
<html>
<head>
<title><xsl:value-of select="headerContent/firstName" />

<xsl:value-of select="headerContent/lastName" />'s Resume
</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>

<xsl:template match="headerContent">
<div align="center">
<xsl:value-of select="firstName" /> <xsl:value-of select="lastName" /> <br />
<xsl:value-of select="address1" />
<xsl:if test="address2">
<br />
<xsl:value-of select="address2" />
</xsl:if>
<br />
<xsl:value-of select="city" />
<xsl:if test="state">
, <xsl:value-of select="state" />
</xsl:if>
<xsl:value-of select="postal" />
<xsl:if test="country">
, <xsl:value-of select="country" />
</xsl:if>

<br />
Tel: <xsl:value-of select="phone" />
<xsl:if test="mobile">
<br />
Mob: <xsl:value-of select="mobile" />
</xsl:if>
</div>
</xsl:template>


<xsl:template match="objective">
<h1><xsl:value-of select="@title" /></h1>
<blockquote>
<xsl:value-of select="objectiveBody" />
</blockquote>
</xsl:template>
<xsl:template match="skills">
<h1><xsl:value-of select="@title" /></h1>
<blockquote>
<xsl:for-each select="skillCategory">
<h2><xsl:value-of select="@title" /></h2>
<ul>
<xsl:for-each select="skill">
<li>
<xsl:value-of select="skill"/>
</li>
</xsl:for-each>
</ul>
</xsl:for-each>
</blockquote>
</xsl:template>
<xsl:template match="employmentHistory">
<h1><xsl:value-of select="@title" /></h1>
<ul>
<xsl:for-each select="employer">
<li>
<xsl:value-of select="fromDate" /> -
<xsl:value-of select="toDate" /><br />
<strong>
<xsl:value-of select="institution" />
</strong>
(
<xsl:value-of select="city" />,
<xsl:value-of select="state" />
)
-
<xsl:value-of select="jobTitle" /> <br />
<xsl:value-of select="activity" />

</li>
</xsl:for-each>
</ul>
</xsl:template>

<xsl:template match="education">
<h1><xsl:value-of select="@title" /></h1>
<ul>
<xsl:for-each select="educationItem">
<li>
<xsl:value-of select="fromDate" /> -
<xsl:value-of select="toDate" /><br />
<strong>
<xsl:value-of select="institution" />
</strong>
(
<xsl:value-of select="city" />,
<xsl:value-of select="state" />
)
-
<xsl:value-of select="activity" /><br />

<xsl:value-of select="grade" />

</li>
</xsl:for-each>
</ul>
</xsl:template>




</xsl:stylesheet>
------

<?xml version='1.0' standalone='no'?>
<!DOCTYPE resume SYSTEM 'resume.dtd'>
<?xml-stylesheet type="text/xsl" href="resume.xsl" ?>
<resume version='1.0' language='en'>
<headerContent>
<firstName>Greg</firstName>
<lastName>Franklin</lastName>
<address1>300 Montgomery Street</address1>
<address2>Suite 201</address2>
<city>Alexandria</city>
<state>VA</state>
<postal>22314</postal>
<phone>703-838-8960</phone>
</headerContent>
<objective title="Objective (or, How I'd like to spend my life)">
<objectiveBody>Body of Objective</objectiveBody>
</objective>
<skills title='Skills'>
<skillCategory title='Software'>
<skill>Macromedia Suite</skill>
<skill>Microsoft Office Suite</skill>
</skillCategory>
<skillCategory title='Operating Systems'>
<skill>Windows</skill>
<skill>MacIntosh</skill>
</skillCategory>
</skills>
<employmentHistory title='Employment History'>
<employer>
<jobTitle>Project Manager</jobTitle>
<fromDate>November 2002</fromDate>
<toDate>Present</toDate>
<institution>AT&T</institution>
<city>Reston</city>
<state>VA</state>
<activity>Supervised a team of 23 developers</activity>
</employer>
<employer>
<jobTitle>Web Developer</jobTitle>
<fromDate>April 2002</fromDate>
<toDate>November 2002</toDate>
<institution>PSI Net</institution>
<city>Arlington</city>
<state>VA</state>
<activity>Developed Web Applications in PHP</activity>
</employer>
</employmentHistory>
<education title='Education'>
<educationItem>
<fromDate>1997</fromDate>
<toDate>2002</toDate>
<institution>George Mason University</institution>
<city>McLean</city>
<state>VA</state>
<activity>Bachelor's Degree in Computer Science</activity>
<grade>4.0 GPA</grade>
</educationItem>
</education>
</resume>
-----

Reply With Quote
  #2  
Old June 19th, 2003, 09:29 AM
claustrophonic claustrophonic is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Nottingham, UK
Posts: 3 claustrophonic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
echo ->
thanks for the info! that's done the trick!

funny I couldn't easily find that solution in any of my documentation.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xsl:value-of not working!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway