troubleshooting Question

Applying templates using XSLT on a simple XML

Avatar of Jammerules
Jammerules asked on
8 Comments1 Solution296 ViewsLast Modified:
I am a noob to XML and XSLT, so pardon me for such a question. Here is what I am trying to do. I have an XML file like this:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="xsltfile_ex2.xslt"?>
      <Salutation>Mr. </Salutation>  

And I have an XSLT file like this:

  <xsl:output method="html"/>

  <xsl:template match="/">
        <xsl:apply-templates select="Profiles/Profile"/>         

  <xsl:template match="Profile"> 
          <xsl:apply-templates select="./FirstName"/>

  <xsl:template match="FirstName">
    <tr bgcolor="red">
        <xsl:apply-templates select="./LastName"/>        

  <xsl:template match="LastName">
    <tr bgcolor="red">
      <xsl:value-of select="./LastName"/>

I am trying to get the Last Name from the XML. What is it that I am doing wrong? If someone also could please explain to me how the control flows in the above example (after correction), I'd appreciate that. Thanks!
IT Business Systems Analyst / Software Developer
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros