|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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> ----- |
|
#2
|
|||
|
|||
|
echo ->
thanks for the info! that's done the trick! funny I couldn't easily find that solution in any of my documentation. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > xsl:value-of not working! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|