Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:50:47+00:00 2026-06-04T12:50:47+00:00

I am trying to do a simple transform of XML using XSLT to generate

  • 0

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:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="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/>

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:

<?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>

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:50:48+00:00Added an answer on June 4, 2026 at 12:50 pm

    Well, I can’t reproduce your symptoms. When I test what you’ve posted it doesn’t produce any output at all. Which looks correct because your xpath is testing the wrong namespace. You need to add in your xslt a namespace-prefix mapping for the http://www.digitalmeasures.com/schema/data namespace, and then use it in the value-of xpath. Like this:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:dmd="http://www.digitalmeasures.com/schema/data-metadata"
      xmlns:dm="http://www.digitalmeasures.com/schema/data">
        <xsl:output method="html" encoding="utf-8"/>
        <xsl:template match="/">
            <xsl:value-of select="/dm:Data/dm:Record/dm:PCI/dm:PREFIX"/>
        </xsl:template>
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’ve been trying to transform some simple XML into another simple XML using XSLT.
I am trying to transform XHTML using an XSLT stylesheet, but I can't even
I'm trying to write a simple .xslt to process .xml files. But I've been
i'm trying to generate html pages by using xslt (using VS 2010 as the
I'm trying to query an xml file using the following xslt: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
I've written a simple XML Document that I am trying to transform with an
I am trying to display xml data in html via XSLT. I am building
I'm trying to take a xml document and transform to a standard html list
i am trying to transform my xml via java/xalan (2.7.1) with org.apache.xalan.xslt.Process class I
I'm trying to write an XSLT that will transform an XML document that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.