XSL Overview (1)

Source: Internet
Author: User
Tags xml parser xsl xsl file
Document directory
  • Question 1: using the Java namespace definition example mentioned above, I wrote an XSL file. What is the resolution effect in IE browser? Why is this effect?
  • <XSL: For-each>
  • <XSL: If>
  • <XSL: Choose>

XSL, Extensible Stylesheet Language, extensible style language.

You can say that he is a style. He said that he is a language because he supports expressions and execution logic;

You can say that he is a language. He can actually convert a Word file into a PDF file.

The following is a simple XSL file:

<? XML version = "1.0" encoding = "UTF-8"?>

<XSL: stylesheet xmlns: XSL = "http://www.w3.org/1999/XSL/Transform" version = "1.0">

<XSL: template match = "/">

<HTML>

</XSL: Template>

</XSL: stylesheet>

From the above XSL example, we can find that:

XSL is an XML file. The first line is a standard XML declaration;

W3C has an international standard for XSL. Generally, the alias of this namespace is XSL;

Correspondingly, there are some transform standards, such as the XML Parser supported by Microsoft: xmlns: msxsl = "urn: Schemas-Microsoft-com: XSLT"

In Java, all static methods can be used in XSL, for example, defining a namespace xmlns: Yizi = "java.net. urlencoder ", then we can write <XSL: value-of select =" Yizi: encode ('HTTP: // www.baidu.com ') "/>

Question 1: using the Java namespace definition example mentioned above, I wrote an XSL file. What is the resolution effect in IE browser? Why is this effect?

 

<? XML version = "1.0" encoding = "UTF-8"?>
<? XML-stylesheet type = "text/XSL" href = "sample. XSL"?>
<HTML xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: nonamespaceschemalocation = "D:/gz_wap.xsd">
<Head>
<Title/>
</Head>
<Body>
<A href = "http://forum.csdn.net/BList/Enterprise" id = "A1"> Enterprise Development Forum </a>
</Body>
</Html>

<XSL: stylesheet xmlns: XSL = "http://www.w3.org/1999/XSL/Transform" version = "1.0" xmlns: Yizi = "java.net. urlencoder">
<XSL: output method = "html"/>
<XSL: template match = "/">
<HTML>
<Body>
Title = <XSL: value-of select = "// A/text ()"/> <br/>
Href = <XSL: value-of select = "// A/@ href"/> <br/>
Urlencode = <XSL: value-of select = "Yizi: encode (// A @ href)"/>
</Body>
</Html>
</XSL: Template>
</XSL: stylesheet>

The most common Node

Example XML:

<? XML version = "1.0" encoding = "UTF-8"?>
<? XML-stylesheet type = "text/XSL" href = "sample. XSL"?>
<HTML>
<Head>
<Title/>
</Head>
<Body>
<A href = "http://forum.csdn.net/BList/Enterprise" id = "A1"> Enterprise Development Forum </a>
<A href = "" id = "A2"> Empty connection </a>
<A href = "http://www.baidu.com" id = "A3"> Baidu </a>
</Body>
</Html>

<XSL: For-each>

 

<XSL: If>

If the href attribute of <A> is null, It is not displayed.

The display format is: Title = Corporate Development Forum, href = http://forum.csdn.net/BList/Enterprise

<XSL: Choose>

Display the href and text () of all <A> labels with the href attribute, display text () without the href attribute, and indicate that the href is empty

The display format is: Title = Corporate Development Forum, href = http://forum.csdn.net/BList/Enterprise

Title = Baidu, href = NULL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.