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 ForumsReportsReportsUsing SQL xml column type with XSLT VisualizerUsing SQL xml column type with XSLT Visualizer
Previous
 
Next
New Post
12/8/2011 4:44 PM
 

I'm trying to use the XSLT Visualizer with a query result that contains an xml column type. The relevant part of the table definition is:

    [CountryCode] [char](2) NOT NULL,
    [PostCode] [nvarchar](20) NULL,
    [Region] [nvarchar](25) NULL,
    [Municipality] [nvarchar](25) NULL,
    [DeliveryAddress] [xml] NULL,

The 'Show XML Source' button on the settings page shows the following:

<DocumentElement>
  <QueryResults>
    <CountryCode>US</CountryCode>
    <PostCode>38117</PostCode>
    <Region>TN</Region>
    <Municipality>Memphis</Municipality>
    <DeliveryAddress>&lt;Address&gt;&lt;Line&gt;c/o John Doe&lt;/Line&gt;&lt;Line&gt;123 Main St&lt;/Line&gt;&lt;Unit&gt;4th Floor&lt;/Unit&gt;&lt;City&gt;Memphis&lt;/City&gt;&lt;State&gt;TN&lt;/State&gt;&lt;PostalCode&gt;38117&lt;/PostalCode&gt;&lt;/Address&gt;</DeliveryAddress>
  </QueryResults>
</DocumentElement>

I tried using the HTML Decode converter on DeliveryAddress but it didn't help.

I spent a little time looking at the source code but I'm going to need to get the source installed so I can step through it in VS it or generate some trace output to figure this out. Before doing that I thought I'd ask for some thoughts on what's causing this and potential workarounds.

  • It appears to be the DataTable.WriteXml method that's encoding the value of that column.
  • Even with the htmldecode converter there is a single child node of DeliveryAddress that is a text() node.
  • I tried msxml:node-set() in the xslt stylesheet but it just returns a text node. It doesn't parse and load it as an XML document or fragment.
  • I tried adding script to the stylesheet to actually load it into an XPathDocument and return an XPathNodeIterator but I get a script not allowed error because the Reports module isn't enabling script execution for the transformation.

Any thoughts on how I should proceed?

Thanks, Paul

 
New Post
2/26/2012 9:22 PM
 

I also can't figure out how to make an XSL transformation with the Reports Module.

I have no idea what to do with the XML namespace or the .Net Type setting

My XSLT works beautifully in Dreamweaver using the XML output from the reports module.  However, when I upload the XSL file.. the only error I get is unhelpful... "XSLT compile error"


It'd be great to have some sample XSL files that work with the reports module...




 
New Post
2/27/2012 10:44 AM
 

Have you clicked on the "Show XML Source" link below your query on Settings page for the module? The module wraps your query results in a top level element named DocumentElement and in that each row is in an element named QueryResults.

You don't need to specify a XML namespace and the .Net Type setting unless you are using an XSLT extenstion object (calling compiled code from within the XSLT stylesheet.) I'm not familiar with Dreamweaver but perhaps there are built in extension object in Dreamweaver that your XSLT is using. If you are, you would have namespaces defined in you stylesheet element. For example, and unrealated to DNN, I use a command line XLST transformer that has all of the EXLT.org extensions built in. So, to use those built in string manipulation extension objects I define a namespace xmlns:str="http://exslt.org/strings" then I can use something like str:replace( $url, '/', '/​' ). If I were to use that replace function in an XSLT file in the DNN Reports module, I would get a compile error.

The other possibility is that Dreamweaver supports XPath 2.0, which .Net does not. So any XPath 2.0 functions would throw a compile error.

 
New Post
2/29/2012 9:38 PM
 

Thanks -- I used the "Show XML source" to generate a static file that I worked from with dreamweaver to style the XML.

I took out a lot of the dreamweaver markup and eventually figured it out.  The top has to be very basic such as in this example.

I figured out I couldn't use the nbsp; in DNN; so I had to use <text> </text> to make a space.  Sloppy but it worked!



<?xml version="1.0"?><!-- DWXMLSource="test.xml" -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" encoding="utf-8"/>

<xsl:template match="/">

<xsl:for-each select="DocumentElement/QueryResults">

<img class="profilepic">
      <xsl:attribute name="src">Portals/0/<xsl:choose><xsl:when test="Folder !=''"><xsl:value-of select="Folder"/></xsl:when><xsl:otherwise>Images/SiteImages/</xsl:otherwise>
</xsl:choose><xsl:choose><xsl:when test="FileName !=''"><xsl:value-of select="FileName"/></xsl:when><xsl:otherwise>no_avatar.gif</xsl:otherwise>
</xsl:choose></xsl:attribute>
      <xsl:attribute name="alt">
      <xsl:text>   </xsl:text><xsl:value-of select="FirstName"/><xsl:text> </xsl:text><xsl:value-of select="LastName"/>
      </xsl:attribute>
      </img>

</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

 
New Post
3/1/2012 12:18 PM
 

Dreamweaver probably declares the nbsp entity for you. You could use &#160; (the decimal code for non-breaking space) instead or define the entity yourself. To define your own entities put the following after the xml declaration and before your stylesheet element (the example has several entities that aren't defined by default):

<!DOCTYPE xsl:stylesheet [
 <!ENTITY nbsp "&#160;">
 <!ENTITY pound "&#163;">
 <!ENTITY yen "&#165;">
 <!ENTITY copy "&#169;">
 <!ENTITY laquo "&#171;">
 <!ENTITY reg "&#174;">
 <!ENTITY middot "&#183;">
 <!ENTITY raquo "&#187;">
 <!ENTITY bull "&#8226;">
 <!ENTITY mdash "&#8212;">
 <!ENTITY ldquo "&#8220;">
 <!ENTITY rdquo "&#8221;">
 <!ENTITY euro "&#8364;">
 <!ENTITY trade "&#8482;">
]> 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsReportsReportsUsing SQL xml column type with XSLT VisualizerUsing SQL xml column type with XSLT Visualizer


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