You are here: Articles > Computers & Technology > xml

 See more articles about "xml "

Tutorial Addendum On XML Technologies - XSL - Accepting Ethics Out Of Antecedent Elements



 31 December 18:00   

    



    



    

Openning dictionary_xsl.xml with Internet Explorer, I got:

    

 

    

d_dictionary

    



    

w__word

    

a___acronym=true

    

e___name

    

t____XML

    

e___definition

    

t____eXtensible Markup

    

Language.

    

e___update

    

a____date=2002-12-23

    

w__word

    

a___symbol=true

    

e___name

    

t____<

    

e___definition

    

t____Mathematical attribute apery the "less than" analytic

    

operation, like: 1<2.

    

e___definition

    

t____Reserved attribute in XML apery the alpha of

    

tags, like:

    

t____<p>Hello world!</p>

    



    



    

Note that:

    



        

  • The arch appearance tells me area that section of achievement came from.


  •     

  • The CDATA area in the endure "definition" aspect was parsed as a afar argument part.

        

    That s why I got two pieces of achievement out of this element.



  •     



    



    



    

The if Element

    



    

if: An XSL element, confined as a codicillary statement. If the defined condition

    

is satisfied, the amid statements will be processed. Otherwise, they will be ignored.

    



    

<xsl:if test="condition">

    

XSL statements

    

</xsl:if>

    



    



    

where "condition" is a analytic expression.

    



    

The accept Element

    



    

choose: An XSL element, confined as a codicillary alternative statement.

    

This is like the "if-else" account in some additional computer languages.

    



    

<xsl:choose>

    

<xsl:when test="condition1">

    

XSL statements

    

</xsl:when>

    

<xsl:when test="condition2">

    

XSL statements

    

</xsl:when>

    

...

    

<xsl:otherwise>

    

XSL statements

    

</xsl:otherwise>

    

</xsl:choose>

    



    



    

where "condition1" and "condition2" are analytic expressions.

    



    

The capricious Element

    



    

variable: An XSL element, confined as a capricious acknowledgment statement.

    

The capricious name is the amount of the "name" attribute. The capricious amount

    

is the agreeable of the account element.

    



    

<xsl:variable name="variable_name">variable_value</xsl:variable>

    



    



    

Once a capricious is define, its amount can be referred by its name pre-fixed

    

with a dollar assurance "$". A capricious can alone be accessed in the aforementioned sub-tree

    

where it is defined. For example:

    



    

<xsl:template match="document">

    

<xsl:variable name="author"><xsl:value-of

    

select="property/@author"/></xsl:variable>

    

<xsl:for-each select="chapter">

    

Author: <xsl:value-of select="$author">

    

...

    

</xsl:for-each>

    

</xsl:template>

    



    



    

In this code, I stored the amount of aspect "author" in aspect "property"

    

in capricious "author". Then I acclimated this capricious in the "for-each" loop.

    



    

Conclusion:

    



    



        

  • "value-of" account can be acclimated to retrieve argument advice out of

        

    the antecedent element.

        



  •     

  • "for-each" account can be acclimated to accomplish a bend over a accumulation of

        

    sub elements or attributes.

        



  •     

  • "if" or "choose" account can be acclimated to make a codicillary block.

        



  •     

  • "variable" account can be acclimated to ascertain a capricious to authority a value.

        



  •     



    



    



 


 variable, statement, element, value, author, statements, select, serving, definitiont, elements, symbol, logical, source, conditional, , < xsl, xsl variable, statement can, xsl when, variable name, author <, xsl statements, element serving, xsl element, statements <, xsl element serving, variable name variable, xsl variable name, xsl when test, xsl getting values,

Share Tutorial Addendum On XML Technologies - XSL - Accepting Ethics Out Of Antecedent Elements:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...