1
Vote

dnnx xsl extension - using variables

description

I set up the new dnnx xsl extension
add this: xmlns:dnnx="http://www.dotnetnuke.com/xml" extension-element-prefixes ="dnnx"
to my style sheet directive

and these in the first template.
<xsl:apply-templates select="dnnx:setPageTitle($PFB_Title + $PFB_date)" /> <!--  for testing xml token extension  -->
<xsl:apply-templates select ="dnnx:setPageDescription('test of description token' + $PFB_Title + $PFB_date)" />
<xsl:apply-templates select ="dnnx:registerStyleSheet('/portals/0/myimportant.css')" />  
and it gives this output in the generated page source.
<title>
NaN
</title>
<meta id="MetaDescription" name="DESCRIPTION" content="NaN" />

css did work:
<link href="/portals/0/my-important.css?cdv=23" type="text/css" rel="stylesheet"/>

I tried without the variables for the title text
<xsl:apply-templates select="dnnx:setPageTitle('test title')" /> <!--  for testing xml token extension  -->
and that seems to work:
<title>
test title
</title>

so do variables need to be used in some other way? those variables are used on the page content and work just fine.

my test page:
http://wga.wbtdev.net/en/test-xml

comments

tvanwynen wrote Feb 20, 2015 at 7:11 PM

found my own answer, if this will help anyone else;

need to process the variables with the concat function inside the extension function call.

then I get a new string from the 2 variables as the page title.

<xsl:apply-templates select="dnnx:setPageTitle(concat($PFB_Title,' ',$PFB_date))" />

tvanwynen wrote Feb 20, 2015 at 7:13 PM

another question: is it possible to concat the new strings to the existing Title or Description?

are those available as parameters to read in and output or is there a way to keep them and add the new strings at the end?

wrote Feb 21, 2015 at 5:24 PM