XSL

  1. What does XSL stand for?
    Xtendable Style Language
  2. What are the three parts of a basic XSL template?
    • 1. XML declaration
    • 2. XSL Stylesheet wrapper
    • 3. XSL output method declaration

    • <?xml version="1.0" ?>
    • <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    • <xsl:output method="html"/>
    • </xsl:stylesheet>
  3. If you output XSL to XML what do you need
    • A document declaration in your output tag
    • <xsl:output method="xml" doctype-system="http://www.useractive.com/dtds/mydtd.dtd" />
  4. What tag do you use to merge data in XSL and what attribute do you use?
    • xsl:template and match
    • <xsl:template match="/"> HELLO</xsl:template>
  5. If you wanted to output a hello everytime you have the tag "bob" how would you do it?
    • <xsl:template match="bob">
    • bob
    • </xsl:template>
  6. What is the difference between push processing and pull processing
    Push processing is pushing the data through the xsl. xsl-apply-templates is this way. Pull processing yanks the data in bits and pieces xsl:for-each is like this.
  7. If you want to match multiple things, what tag do you use?
    xsl:apply-templates
  8. How is xsl:apply-templates used?
    • use a main xsl:template and match on a main item. Within that tag, use the xsl:apply-templates to match on sub-tags and attributes. each xsl:apply templates should have it's own xsl:template tag in the xsl but not in the main xsl:template:
    • <xsl:template match="LISTING">
    • <xsl:apply-templates select="FIRST" />
    • <xsl:apply-templates select="LAST" />
    • <xsl:apply-templates select="PHONE" />
    • </xsl:template>
    • <xsl:template match="FIRST">first</xsl:template><xsl:template match="LAST">last</xsl:template><xsl:template match="PHONE">phone</xsl:template>
  9. If you are using the xsl:apply-templates and you want to input the matched items contents, what would you use?
    You match in the main xsl templat and then in the match for the apply templates you simply add another

    • <xsl:template match="FIRST">
    • <xsl:apply-templates /> <! -- instead of item you want entered-->
    • </xsl:template>
  10. If you don't want to use xsl:apply-templates to match each and every xml tag, what alternative tag can you use that immediately places in the value within the tag?
    xsl:value-of

    <xsl:value-of select="LAST"/>
  11. If you want to place in the attribute of a value, what would you use.
    @

    as in <xsl:value-of select="PHONE/@TYPE"/>

    Remember that everything is relative to the matching tag of the xsl:template main section. So if you want an attribute of a sub tag you would need to list that tag followed by a /
Author
dalbabes
ID
60627
Card Set
XSL
Description
Oreilly
Updated