UmbracoXslDevelopmentTemplate CQ

Recommended tools

  1. Visual Studio Express
  2. Foxe

Visual Studio

It provides intelligence prompt for the xsl key words to facilitate the work on the xsl.

image

Foxe

It provides a tree-nodes like view on the xml document to facilitate the navigation on the umbraco.config cache file.

image

Template Codes

With the help of the two utility, copy the following code to start your umbraco xslt development.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#x00A0;">
]>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform%22
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
  xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
  xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
  xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
  xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
  xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
  xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

  <xsl:output method="xml" omit-xml-declaration="yes"/>

  <xsl:param name="currentPage"/>


  <xsl:template match="/">
    <!--The code here-->
  </xsl:template>
</xsl:stylesheet>

The xslt file is stored in the ~/xslt/ folder. The target xml file is at ~/App_Data/umbraco.config.

The following key words are commonly used when you write the xsl.

  1. value-of
  2. select
  3. attribute
  4. for-each
  5. sort
  6. if

The following key words are commonly used when you write the xsl.

  1. parent::*
  2. child::*
  3. [@attributeName expression]

Have a fun in coding with xsl for umbraco.config.

Supported by Nova Umbraco

原文地址:https://www.cnblogs.com/czy/p/2432590.html