Mapping with User-Defined XSLT Templates

You can map non-terminal elements by importing user-defined XSLT templates into a transformation map.

To use a user-defined template in a transformation map, create an XSLT style sheet file containing a single named template and import this file into the Sybase project where your transformation service resides.

To map using a user-defined XSLT template:

  1. Write the template. Give the filename the .xsl extension, for example, Transform.xsl.

    Example file:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <xsl:stylesheet version="1.0" 
    
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:output method="xml"/>
    
              <xsl:template name="DateTemplate">
    
                      <year>
    
                                  <xsl:value-of select="Year"/>
    
                      </year>
    
                      <month>
    
                                   <xsl:value-of select="Month"/>
    
                       </month>
    
                       <day>
    
                                   <xsl:value-of select="Day"/>
    
                       </day>
    
              </xsl:template>
    
    </xsl:stylesheet>
    

  2. Import the XSL file into your project.

  3. On the Map canvas for your transformation service, right-click a link and select Browse for Template.

  4. Set the Mapping Mode property to for-each.

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com