Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

$4.95 Windows Hosting at Webhost4life.com
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Biz Modules provides professional business modules and solutions for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
ExactTarget email software solutions
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  XML Module [Lea...  Available Tokens
Previous Previous
 
Next Next
New Post 9/15/2005 4:36 AM
User is offline Mattias Åslund
4 posts
10th Ranked


Re: Available Tokens 

It looks like you have the stumbled on the same problems as I just did, but not persued it further?!

I need to have the user-selected language available for the XSLT-engine, so I can retrieve the correct texts from an XML-file.

If you are still interested in doing the rewrites, I hope you include this. Otherwise, I'll just have to look into it myself when I get the time...

Yours,
Mattias Åslund

 
New Post 4/15/2008 3:19 PM
User is offline richard.clayton()
1 posts
10th Ranked


Re: Available Tokens 

So, it's 2008 and I was still running into the same problems these gentlemen were having with the XML module in 2005 (mainly lack of XSL 2.0 functionality).  So, After doing a bunch or research, I got the XML module to implement my own functions using the XsltArgumentList.AddExtensionObject() feature.  All you have to do it make a quick edit to the ParameterList.vb file in the App_Code/XML/Parameters directory.

Example:

Public Function ToXsltArgumentList() As System.Xml.Xsl.XsltArgumentList
            Dim xslArg As New System.Xml.Xsl.XsltArgumentList
            For Each param As ParameterInfo In Me
                If param.IsValidDefinition Then
                    Dim value As String = param.GetValue
                    If value.Length > 0 Then xslArg.AddParam(System.Xml.XmlConvert.EncodeName(param.Name), "", param.GetValue)
                End If
            Next
            Dim obj As New XslFunctions()
            xslArg.AddExtensionObject("urn:XslFunctions", obj)
            Return xslArg
        End Function

 

Here is a sample of my XslFunctions object:

Option Strict On
Option Explicit On

Imports System
Imports System.Text
Imports System.IO
Imports System.Xml

Imports DotNetNuke.Entities.Users

Namespace DotNetNuke.Modules.XML

    'MY STUPID FIX TO DNN AND MICROSOFT'S LACK OF XSL/XPATH SUPPORT

    Public Class XslFunctions

        'DATE TIME FUNCTIONS
        Public Function GetCurrentDate() As String
            Return Date.Now.Year.ToString("0000") + "-" + Date.Now.Month.ToString("00") + "-" + Date.Now.Day.ToString("00")
        End Function

        Public Function GetDayInFuture(ByVal noOfDays As Double) As String
            Dim dtp1 As DateTime = DateTime.Now.AddDays(noOfDays)
            Dim newDay As String = dtp1.Year.ToString("0000") + "-" + dtp1.Month.ToString("00") + "-" + dtp1.Day.ToString("00")
            Return newDay
        End Function

        Public Function ParseDate(ByVal strDate As String) As DateTime
            Dim year As Integer = Int16.Parse(strDate.Substring(0, 4))
            Dim month As Integer = Int16.Parse(strDate.Substring(5, 2))
            Dim day As Integer = Int16.Parse(strDate.Substring(8, 2))
            Dim hour As Integer = Int16.Parse(strDate.Substring(11, 2))
            Dim minute As Integer = Int16.Parse(strDate.Substring(14, 2))
            Dim second As Integer = Int16.Parse(strDate.Substring(17, 2))
            Return New DateTime(year, month, day, hour, minute, second)
        End Function

        Public Function GetCurrentTime() As String
            Return Date.Now.Hour.ToString("00") + ":" + Date.Now.Minute.ToString("00")
        End Function

        Public Function Space(ByVal count As Integer) As String
            Dim spaces As String = ""
            For i As Integer = 1 To count
                spaces &= " "
            Next i
            Return spaces
        End Function

        Public Function GetDateObj(ByVal offset As Integer) As DateTime
            Return DateTime.Now.AddDays(offset)
        End Function

        Public Function GetDate(ByVal dt As DateTime) As String
            Return dt.Year.ToString("0000") + "-" + dt.Month.ToString("00") + "-" + dt.Day.ToString("00")
        End Function

        Public Function GetTime(ByVal tm As DateTime) As String
            Return tm.Hour.ToString("00") + ":" + tm.Minute.ToString("00")
        End Function

        Public Function ParseAndGetDate(ByVal iso8601dtg As String) As String
            Dim dtg As DateTime = ParseDate(iso8601dtg)
            Return GetDate(dtg)
        End Function

        'Many of these are just the basic .NET string functions...
Public Function SubString(ByVal original As String, ByVal startIndex As Integer) As String
            Return original.Substring(startIndex)
        End Function

        Public Function SubString(ByVal original As String, ByVal startIndex As Integer, ByVal length As Integer) As String
            Return original.Substring(startIndex, length)
        End Function

        Public Function Replace(ByVal original As String, ByVal oldValue As String, ByVal newValue As String) As String
            Return original.Replace(oldValue, newValue)
        End Function

        Public Function Remove(ByVal original As String, ByVal startIndex As Integer) As String
            Return original.Remove(startIndex)
        End Function

        Public Function Remove(ByVal original As String, ByVal startIndex As Integer, ByVal length As Integer) As String
            Return original.Remove(startIndex, length)
        End Function

        Public Function ToUpper(ByVal original As String) As String
            Return original.ToUpper()
        End Function

        Public Function ToLower(ByVal original As String) As String
            Return original.ToLower()
        End Function

        Public Function Trim(ByVal original As String) As String
            Return original.Trim()
        End Function

        Public Function IndexOf(ByVal original As String, ByVal value As String) As Integer
            Return original.IndexOf(value)
        End Function

        Public Function IndexOf(ByVal original As String, ByVal value As String, ByVal startIndex As Integer) As Integer
            Return original.IndexOf(value, startIndex)
        End Function

        Public Function IndexOf(ByVal original As String, ByVal value As String, ByVal startIndex As Integer, ByVal count As Integer) As Integer
            Return original.IndexOf(value, startIndex, count)
        End Function

        Public Function Insert(ByVal original As String, ByVal startIndex As Integer, ByVal value As String) As String
            Return original.Insert(startIndex, value)
        End Function

        Public Function Length(ByVal original As String) As Integer
            Return original.Length
        End Function

        Public Function StartsWith(ByVal original As String, ByVal value As String) As Boolean
            Return original.StartsWith(value)
        End Function

        Public Function EndsWith(ByVal original As String, ByVal value As String) As Boolean
            Return original.EndsWith(value)
        End Function

        Public Function Contains(ByVal original As String, ByVal value As String) As Boolean
            Return original.Contains(value)
        End Function

    End Class 'XslFunctions
End Namespace

 

Not too difficult. Here's an example of it's implementation in the XSL File:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="urn:XslFunctions">
 <xsl:output method="html" encoding="iso-8859-1"/>
 <!-- This template matches all planets elements -->
 <xsl:template match="/">
  <!-- GRAB CURRENT DATE AND TEST TO SEE IF THERE ARE RESULTS -->
  <xsl:variable name="today" select="fn:GetCurrentDate()" />
    <xsl:variable name="todayPlus1" select="fn:GetDayInFuture(1)" />
    <xsl:variable name="todayPlus2" select="fn:GetDayInFuture(2)" />

      <!-- etc, etc, etc, -->

<xsl:value-of select="fn:GetDayOfWeek(fn:GetDateObj(0))" />,<xsl:value-of select="$sp" />
       <xsl:value-of select="fn:getMonthName(fn:GetMonthInt(fn:GetDateObj(0)))" /><xsl:value-of select="$sp" />
       <xsl:value-of select="fn:GetDay(fn:GetDateObj(0))" />

      <!-- etc, etc, etc, -->

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

The cool thing about the whole technique is that you can expose a much richer (and specific) set of functions than even what XSL 2.0 supports.  If there was a way I could attach the files to this post, I would give you the full source.  Sorry!

Richard

 
New Post 4/15/2008 11:07 PM
User is offline Stefan Cullmann
1379 posts
6th Ranked








Richard, cool stuff, and I was working on something similar. Re: Available Tokens 

Richard, cool stuff indeed.

These gentlemen had very different problems than you. In 2005 XML module did not support any parameter. It was near to impossible to pass context information out of DotNetNuke into a transformation. You are going a step further and extend the parameters with a custom extension object. The WSP based nature of the XML module allows users to apply your fix immediately.

However extension object requires the FullTrust permission set, it won’t run on medium trust. So the extension should be at least optional.

Richard, if you have time and interest to volunteer, you might want to help me to get that into the core module? Please drop a line per email, if you are interested.


Stefan Cullmann - stefan.cullmann [at] dotnetnuke.com

forms & Lists (UDT5.0) will be the next major release of the User Defined Table project.
A first Preview is available, though it requires DotnetNuke 5 (Beta 5) to run.

 
New Post 5/6/2008 7:27 AM
User is offline Tom Van Wynen
28 posts
www.wycliffe.net
10th Ranked


Re: Richard, cool stuff, and I was working on something similar. Re: Available Tokens 

Hi Stefan, this sounds like a thread that might have some possiblities for my question:

Would it be possible for the XML module to write/append strings to existing DNN tokens? I don't know enough about the token structure to know if this is possible at all.

I use the XML module heavily to read live xml sources for a dynamic DNN site that pulls content from internal data systems into a single DNN page.

Part of the information includes country and language names. I would love to be able to add the country and language names to the Title token and have it show up as part of the page title: 

http://www.wycliffe.net/home/Africa/Country/tabid/469/Default.aspx?country=KE

<TITLE>
   Wycliffe International - Africa Country
  </TITLE>

would display Wycliffe International - Africa - Kenya
instead.

and

http://www.wycliffe.net/home/Africa/Languages/tabid/470/Default.aspx?country=KE&code=kik
<TITLE>
   Wycliffe International - Africa Language
  </TITLE>

would display Wycliffe International - Africa Language - Gikuyu
instead.

thanks for thinking about this,

tomvw

p.s.  I am looking into rewrite engines to hide the parameters, like DNN friendly URLs does, for my parameters.

 

 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  XML Module [Lea...  Available Tokens
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Glanton: Enterprise Intranet Specialists Using DNN
Glanton Solutions are a premier provider of sevices for large corporates lloking to outsource Intranet sites.
www.glanton.com
Jetkey Smart Map
Smart Map is an AJAX powered Google Map module that displays driving directions, proximity search results and data from your own databases. Smart Map reads GPX (GPS data) files, GeoRSS feeds, and KML data. You can pass any querystring parameter to Smart Map and into your own custom queries to control what data displays on the map.
smartmap.jetkey.com
DNNSpired.com
Inspired to extend DotNetNuke®, everyday.
www.DNNSpired.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP