Well, to find out which template tags are availiable when working with XSLT templates in Dynamicweb CMS you need to insert this:
<xsl:text disable-output-escaping="yes"><![CDATA[<!--@DwTemplateTags-->]]></xsl:text>
Friday, December 12, 2008
DwTemplateTags in XSLT templates
By
Sten Hougaard
on
Friday, December 12, 2008
1 kommentarer
Etiketter: Dynamic Web CMS, XSL
Monday, July 7, 2008
Simulating SQL "DISTINCT" in XSLT
If you have a list of elements from which you only want one occurance of each unique value, in SQL you would just add "DISTINCT" infront of the column. You can do something in XSLT which gives you the same functionality. Take a look at this example://Product[Hight][not(Hight=preceding-sibling::Product/Hight)]
This example will do just that with Product elements with a subnode called Hight. So only one occurance of each Hight!
By
Sten Hougaard
on
Monday, July 07, 2008
0
kommentarer
Monday, March 17, 2008
Save the XML navigation data
When working with XSLT based menues in Dynamicweb you will need to see the actual XML document which your XSLT works with - you can extend the URL with: "SaveXml=True" and a XML document will be saved in "Templates\Navigation". A dynamic name will be applied - for example: "TestNavigationData137.xml".
You may read about this here: http://www.dynamicweb.dk/Developer-forum-25346.aspx?action=ShowThread&ThreadID=163
By
Sten Hougaard
on
Monday, March 17, 2008
0
kommentarer
Etiketter: Dynamic Web CMS, XSL
Wednesday, November 14, 2007
Return the XML input document
This XSLT document will return a copy of the input, usefull if you do not know the structure of the XML which you need to transform:
<?xml version="1.0" encoding="UTF-8"?>
<?xml:namespace prefix = xsl /><xsl:stylesheet fo="http://www.w3.org/1999/XSL/Format" xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output declaration="yes" encoding="utf-8" indent="yes" method="html">
<xsl:template match="/">
<xsl:apply-templates select="*@*node()comment()processing-instruction()">
</xsl:template>
<xsl:template match="*@*node()comment()processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="*@*node()comment()processing-instruction()">
</xsl:copy>
</xsl:template>
</xsl:stylesheet></p>
</xsl:apply-templates></xsl:apply-templates></xsl:output>
By
Sten Hougaard
on
Wednesday, November 14, 2007
0
kommentarer
Etiketter: Dynamic Web CMS, XSL
Friday, July 6, 2007
XSL: A "showAll" template - unpacking XML node
This XSL template "showAll" will show the contents of a node.
Call it this way:
<xsl:call-template name="showAll">
<xsl:with-param name="showText" select="1" />
</xsl:call-template>
Where the param "showText" decides if you wish to see the text contents from
the nodes.
Here is the template:
<xsl:template name="showAll">
<xsl:param name="showText" />
<div style="padding-left: 10px; border-left: dotted 1px #e0e0e0;">
<xsl:for-each select="*">
<div style="padding-left: 10px;">
<<xsl:value-of select="name(.)"/>
<xsl:for-each select="@*">
 <xsl:value-of select="name(.)"/>="<xsl:value-of select="."/>"
</xsl:for-each>>
<xsl:if test="$showText=1">
<xsl:value-of select="text()"/>
</xsl:if>
<xsl:if test ="count(*)>0">
<br />
<xsl:call-template name="showAll">
<xsl:with-param name="showText" select="$showText" />
</xsl:call-template>
</xsl:if>
<xsl:if test ="string-length(.)=0
and $showText!=1">
/><br />
</xsl:if>
<xsl:if test ="string-length(.)>0">
</<xsl:value-of select="name(.)" />><br />
</xsl:if>
</div>
</xsl:for-each>
</div>
</xsl:template>
By
Sten Hougaard
on
Friday, July 06, 2007
0
kommentarer