BizTalk Utilities CV ,   Jobs ,   Code library  
 
 
Page 11 of 28

 

Previous Page Table Of Contents Next Page

XSLT Tutorial

XSLT Elements: xsl:template, xsl:apply-templates

We have already discussed how XSLT is the transformation tool, whereby we can take an XML file (or files) and convert it to HTML, another XML file, SQL select statements - or any text-based format.  

The XSLT elements are the main building blocks for the actual transformation that occurs in your XSL file.

xsl:template

  • The template is the basis of the rule-based architecture that XSLT uses.  
  • You define the template to produce an outcome, so whenever you call that template (using xsl:apply-templates or xsl:call-template), it handles this output.
  • The template is processed either by its match or name attributes.  

    The match attribute uses a pattern, 

    The name is whatever name you give it.

  • Another important attribute of the template is the mode attribute.  If you want different formatting from the general template that you have defined, you can define different modes for that node, which will ignore the general match instruction.

Note: You need to have at least one template in your XSLT file.

xsl:apply-template

  • The apply-template element is always found inside a template body.  

  • It defines a set of nodes to be processed.  In this process, it then may find any 'sub' template rules to process (child elements of element in context).

  • If you want the apply-template instruction to only process certain child elements, you can define a select attribute, to only process specific nodes.  In the following example, we only want to process the 'name' and 'address' elements in the root document element:

<xsl:template match="/">
    <xsl:apply-templates select="person/name | person/address"/>
</xsl:template>

 Open Worksheet 3 for a xsl:template & xsl:apply-template example

Page 11 of 28

 

Previous Page Table Of Contents Next Page
 

Recent Jobs

Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C
Sr. Software Engineer

View all Jobs (Add yours)
View all CV (Add yours)



conference calling services
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses
UK Dedicated Servers
online fax


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP