Issue with xslt transforming xml to output html

NeoPhyteX

New Member
I am trying to do a simple transform of XML using XSLT to generate HTML, but I'm having difficulties and I can't seem to figure out what the problem is. Here is a sample of the XML I am working with:\[code\]<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/10744262/file://localhost/C:/Users/cgubata/Documents/Digital Measures/jcamp_fac_ex_xslt.xsl"?><Data xmlns="http://www.digitalmeasures.com/schema/data" xmlns:dmd="http://www.digitalmeasures.com/schema/data-metadata" dmd:date="2012-02-27"><Record userId="310106" username="jcamp" termId="453" dmd:surveyId="1154523"> <dmd:IndexEntry indexKey="COLLEGE" entryKey="School of Business" text="School of Business"/> <dmd:IndexEntry indexKey="DEPARTMENT" entryKey="Accountancy" text="Accountancy"/> <dmd:IndexEntry indexKey="DEPARTMENT" entryKey="MBA" text="MBA"/> <PCI id="11454808064" dmd:lastModified="2012-02-08T13:17:39"> <PREFIX>Dr.</PREFIX> <FNAME>Julia</FNAME> <PFNAME/> <MNAME>M.</MNAME> <LNAME>Camp</LNAME> <SUFFIX/> <ALT_NAME>Julia M. Brennan</ALT_NAME> <ENDPOS/>\[/code\]All I want to do is have the value for some of the nodes to be displayed in HTML. So for example, I might want the PREFIC, FNAME, LNAME nodes to display as "Dr. Julia Camp" (no quotes - I'll do styling later). Here's the XSL that I am using:\[code\]<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="jcamp_fac_ex.xml" --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dmd="http://www.digitalmeasures.com/schema/data-metadata"> <xsl:output method="html" encoding="utf-8"/><xsl:template match="/"><xsl:value-of select="/Data/Record/PCI/PREFIX"/></xsl:template></xsl:stylesheet>\[/code\]From what I been researching, that should show the value of that PREFIX field. But instead, it is outputting all of the values from all of the nodes (so if there are 4000 nodes with a text value, I am getting 4000 values returned in HTML). My goal will be to pull out the values from certain nodes, and I will probably arrange them in a table. How do I pull out the values from a specific node? Thanks in advance.
 
Back
Top