Global GuideLine Home HTML Tutorial JavaScript Tutorial SQL Tutorial CSS Tutorial SEO Tutorial XML Tutorial XSLT Tutorial Articles Tutorial Interview Questions and Answers Guide Jobs GuideLine Bookmark With Google Bookmark With Yahoo Bookmark With FaceBook Bookmark With Live Follow @GlobalGuideLine on Twitter Bookmark Global GuideLine
XSLT Combining, XSLT Tutorial, Global Guideline

Bookmark this webpage. Bookmark: XSLT Combining, XSLT Tutorial Global Guideline is UNITED STATES's favorite website


      Home                    

Basic XSLT Tutorial.     
 XSLT Introduction.          
 XSLT Templates.            
 XSLT Attributes.              
 XSLT Transformation.     
 XSLT Variables.              
 XSLT Formatting.            
 XSLT Loops.                   
 XSLT Sorting.                 
 XSLT Conditions.             
 XSLT Multi Selection.     
 XSLT Functions.              
 XSLT Copying.                
 XSLT Combining.
 XSLT Summary.              

XSLT Tutorial >> XSLT Combining.


     Back             Next     



XSLT Combining is use to combine any other external XSLT document.  The <xsl:include> and <xsl:import> instructions give us ways to incorporate XSLT style sheets programmatically. There are two situations where this is useful.

Large and complex style sheets, like large complex other programs such as C++, are easier to maintain when you break them into multiple documents with specific roles to play. In XSLT combining, the <xsl:include> and <xsl:import> instructions let you assemble the pieces in one master XSLT document. This modular advance approach also makes it possible to share parts of a style sheet with other style sheets that only want certain features and not the whole thing; they can just include or import the parts they needed.

Customizing an existing style sheet without actually editing that style sheet is easy, because we incorporate it, and then separately override any template rules that don't do exactly what we want.

XSLT Tutorial section of <xsl:include> instruction is similar to the <xsl:include> instructions available in several programming languages like Java. The XSLT processor replaces it with the contents of the style sheet named in the href attribute. For example, the following XSLT_Combining.xsl style sheet names the XSLT_Combining_with_XSL_Include.xsl style sheet to incorporate that style sheet:

Example of XSLT Combining

XML for XSLT Combining Example with <xsl:include> [XSLT_Combining.xml]

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="XSLT_Combining.xsl"?>
  <employees>
    <employee username="Emp1">
      <employee_id>104</employee_id>
      <employee_name>Smith</employee_name>
    </employee>
    <employee username="Emp2">
      <employee_id>107</employee_id>
      <employee_name>Mariya</employee_name>
    </employee>
  </employees>

XSLT for XSLT Combining Example [XSLT_Combining.xsl]

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:template match="employees">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>XSLT Combining Example in XSLT Tutorial</title> </head>
<body>
  <h1>
    <a href="http://www.globalguideline.com/xslt/"><font color="0066CC">
    Example of XSLT Combining at Global Guide Line XSLT Tutorial
    </font></a>
  </h1>
  <h2>Employees at Global Guide Line</h2>
  <ul> 
    <xsl:apply-templates select="employee">
      <xsl:sort select="employee_name" />
    </xsl:apply-templates>
  </ul>
</body>
</html> 
</xsl:template>
<xsl:include href="XSLT_Combining_with_XSL_Include.xsl"/>
</xsl:stylesheet>

XSLT Combining with <xsl:include> [XSLT_Combining_with_XSL_Include.xsl]

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

<xsl:template match="employee">
  <li>
    <b><xsl:value-of select="employee_id"/></b>, 
    <i><xsl:value-of select="employee_name"/></i>  
    working at Global Guide Line.
  </li> 
</xsl:template>

</xsl:stylesheet>

Complete Example of XSLT Combining

View complete sources and outputs by simply clicking on file name of XSLT, XML and Out Put of XSLT Combining Example.
 

Caution:  Result may differ; in Microsoft internet explorer Netscape navigator or Firefox may display with a little bit of difference.

     Back             Next     
 
In order to link this page as Reference, click on below text area and pres (CTRL-C) to copy the code in clipboard or pres right click then copy the following lines after that past into your website or Blog.

Get Reference Link To This Page: (copy below code by (CTRL-C) and paste into your website or Blog)
HTML Rendering of above code:

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright © 2005-2006 www.globalguideline.com All rights reserved. Join Global Guide Line community. 240 visitors are online now