![]() | |||||||||||||||||||||
![]() |
|
|
The Same But Different Most of the tags in the previous example are very obviously HTML tags. They are the tags that allow the data to be converted to the "legacy" HTML format. However, there are new tags. These are the XSL tags that allow for the XML data to be displayed and manipulated. It is very easy to see the XSL tags as they all begin with xsl. Two examples from the previous XSL information: <xsl:for-each select="topic" order-by="+ topic-name"> Allows the looping through all the "topic" elements which are sorted in descending order by "topic-name". <xsl:value-of select="topic-name"/> Displays the XML value for this field. One very noticeable tag, however, is the link tag. In HTML it is normally displayed <a href="website">. Since the data for the link is contained in XML the XSL form is more structured. In order to put link data within the tag each attribute must be designated and then the XML data inputted.
<A> <xsl:attribute name="href"> <xsl:value-of select="link"/> </xsl:attribute> <xsl:value-of select="section"/> </A> Another example of setting XML data equal to attributes within a tag:
<img> <xsl:attribute name="src"> <xsl:value-of select="image" /> </xsl:attribute> <xsl:attribute name="border"> 0 </xsl:attribute> <xsl:attribute name="width"> 80 </xsl:attribute> <xsl:attribute name="height"> 100 </xsl:attribute> </img> In both of these examples the data is placed within the actual HTML tags. This is very useful for pulling links or as in the second example, images from the XML data of another source.
|
Section 2: XSL Power! Section 3: Same Difference Section 4: XSL+XML+ASP=HTML
| ||||||||||||||||||||||