Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Use When (1/2) >

Use-when attribute

Attribute use-whenCan be used on any element in the stylesheet. If the boolean value of the expression in this attribute equals "false" then the element and its descendants are removed from the stylesheet.

It is important not to forget to put this attribute into xsl namespace when it is used on elements from other namespaces.

XSLT

      <xsl:stylesheet
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/aaa">
                  <xxx>
                        <xsl:value-of  use-when="true()"
                                    select="111"/>
                  </xxx>
                  <yyy>
                        <xsl:value-of  use-when="false()"
                                    select="333"/>
                  </yyy>
                  <zzz  xsl:use-when="false()"/>
                  <ooo  use-when="false"/>
                  <ppp  xsl:use-when="true()"
                              use-when="false"/>
                  <qqq  xsl:use-when="false()"
                              use-when="true"/>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

      <xxx>111</xxx>
      <yyy/>
      <ooo  use-when="false"/>
      <ppp  use-when="false"/>


Previous chapter: Errors
Next chapter: Collations
Previous page: - - -
Next page: Use-when for compatibility

Kevin Carr in Stanton

Natural Skin Care and European Soaps
TickTalk 5
city of stanton
internetusers


You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks