Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsFirst shot at XSLFirst shot at XSL
Previous
 
Next
New Post
6/25/2008 6:18 AM
 

Hey Guys,

I thought I would give the XSL Transformation engine a go. Never used XSL before but it looks interesting. Sadly it's not showing any results so far.. after hours of head scratching, it's time to ask for help :)

My XML Source is:
<DocumentElement>
  <QueryResults>
    <FirstName>John</FirstName>
    <LastName>Doe</LastName>
    <Email>test@test.com</Email>
    <PropertyValue>01234 567890</PropertyValue>
  </QueryResults>
  <QueryResults>
    <FirstName>Jane</FirstName>
    <LastName>Doe</LastName>
    <Email>janedoe@test.com</Email>
    <PropertyValue>09876 543123</PropertyValue>
  </QueryResults>
</DocumentElement>

My XSLT File looks like this.. I started off basic and once I get results will modfify.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>
<xsl:template match="DocumentElement">
    <table border="1">
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
        <th>PropertyValue</th>
      </tr>
      <xsl:for-each select="DocumentElement/QueryResults">
      <tr>
        <td><xsl:value-of select="FirstName"/></td>
        <td><xsl:value-of select="LastName"/></td>
        <td><xsl:value-of select="Email"/></td>
        <td><xsl:value-of select="PropertyValue"/></td>
      </tr>
      </xsl:for-each>
    </table>
</xsl:template>
</xsl:stylesheet>

 

When I run this I get no results. No errors either so that's good :D

Any ideas on what I am missing ?

Cheers !

 
New Post
6/27/2008 4:19 PM
 

Try this one....

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8"/>

<xsl:template match="/">
    <table border="1">
      <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        <th>Email</th>
        <th>PropertyValue</th>
      </tr>
        <xsl:for-each select="DocumentElement/QueryResults">
    <tr>
        <td><xsl:value-of select="FirstName"/></td>
        <td><xsl:value-of select="LastName"/></td>
        <td><xsl:value-of select="Email"/></td>
        <td><xsl:value-of select="PropertyValue"/></td>
      </tr>

    </xsl:for-each>
    </table>
</xsl:template>

</xsl:stylesheet>

 
New Post
6/27/2008 4:54 PM
 

Or remove DocumentElement from the for-each.  

As you used DocumentElement in your template match= statement - you are already positioned on the root node, therefore your foreach is actually trying to look for DocumentElement/DocumentElement/QueryResult


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
7/4/2008 6:10 AM
 

Excellent, thanks guys, that's sorted it !!!

Many thanks !

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsFirst shot at XSLFirst shot at XSL


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out