Welcome to Catalog Tips

Search more than 200 articles to learn more about creating and automating your product catalogs

Tip: Start typing in the input box for immediate search results.

< All Topics
Print

APPLYXSLT – Apply XSLT transformation

Overview

This Custom Field applies an XSLT transformation to the contents of a field, which should contain an XML fragment. Files are referenced from the data sources XSLT folder.

Requires the EasyCatalog XML data provider.

Syntax

APPLYXSLT(Namelist,’format.xsl‘)

Element Description
FieldName The field name to which the XLST template will be applied
XLST FileName The name of the XLST template to apply to an XML fragment in the specified field

Example

APPLYXSLT(Namelist,‘format.xsl’)

Contents of format.xsl:

<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>

   <xsl:template match=”/”>

       <html>

           <body>

                <table>

                   <xsl:for-each select=”//Option1[position() = 1]”>

                          <tr>

                               <th><xsl:value-of select=”@col1″/></th>

                               <th><xsl:value-of select=”@col2″/></th>

                         </tr>

                   </xsl:for-each>

                   <xsl:for-each select=”//Option1[position() &gt; 1]”>

                        <tr>

                           <td><xsl:value-of select=”@col1″/></td>

                           <td><xsl:value-of select=”@col2″/></td>

                        </tr>

                  </xsl:for-each>

                 </table>

              </body>

          </html>

     </xsl:template>

</xsl:stylesheet>

See also

EVALUATEXPATH

 

Table of Contents