Skip to main contentdfsdf

    • The <xsl:apply-templates> element applies a template to the current  element or to the current element's child nodes.
    • If we add a select attribute to the <xsl:apply-templates>  element it will process only the child element that matches the value of the  attribute
    • The <xsl:choose> element is used in conjunction with <xsl:when>  and <xsl:otherwise> to express multiple  conditional tests.
    • <xsl:choose>  <xsl:when test="expression">  ... some output ...  </xsl:when>  <xsl:otherwise>  ... some output ....  </xsl:otherwise> </xsl:choose>
    • <xsl:if test="expression">  ...  ...some output if the expression is true...  ... </xsl:if>
    • add the <xsl:if> element inside the <xsl:for-each> element

    1 more annotation...

    • To sort the output, simply add an <xsl:sort> element inside the <xsl:for-each> element in  the XSL file:
    • <xsl:for-each select="catalog/cd">  <xsl:sort select="artist"/>
    • The <xsl:for-each> Element

       

      The XSL <xsl:for-each> element can be used to select every XML element of a specified node-set:

    • <xsl:for-each select="catalog/cd">

    2 more annotations...

    • The <xsl:value-of> element is used to extract the value of a selected node.
    • <xsl:value-of select="catalog/cd/title"/>

    1 more annotation...

    • An XSL style sheet consists of one or more set of rules that  are called templates.

        

      Each template contains rules to apply when a  specified node is matched.

    • <xsl:template> element is used to build templates.

        

      The match attribute is used to associate a template with an XML element. The match attribute can also be used to define a template for the  entire XML document. The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document).

    4 more annotations...

    • <?xml-stylesheet type="text/xsl" href="http://www.w3schools.com/cdcatalog.xsl"?>
    • <?xml-stylesheet type="text/xsl" href="http://www.w3schools.com/cdcatalog.xsl"?>

    7 more annotations...

      • What is XSLT?

         
           
        • XSLT stands for XSL Transformations
        •  
        • XSLT is the most important part of XSL
        •  
        • XSLT transforms an XML document into another XML document
        •  
        • XSLT uses XPath to navigate in XML documents
        •  
        • XSLT is a W3C Recommendation
    • XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element.

    3 more annotations...

    • XSL stands for EXtensible Stylesheet Language.
    • XSL describes how the XML document should be displayed!

    1 more annotation...

    • XSL stands for EXtensible Stylesheet Language.
    • there was a need for an XML-based style sheet language.

    1 more annotation...

    • <xsl:template
         match = pattern
         name = qname
         priority = number
         mode = qname>
    • In the absence of a select attribute, the  xsl:apply-templates instruction processes all of the children of  the current node, including text nodes

    3 more annotations...

1 - 12 of 12
20 items/page
List Comments (0)