Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

XSLT- conversion

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

XSLT is a language used to convert XML documents into XHTML documents or other XML documents. XPath is a language for navigating through XML documents.

Correct stylesheet declaration

Declare the document as the root element of the XSL stylesheet is or.

Note: and are completely synonymous and can be used!

According to the W3C XSLT standard, the correct way to declare an XSL stylesheet is:

Or:

To access the elements, attributes, and features of XSLT, we must declare the XSLT namespace at the top of the document.

The "xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" points to the official W3C XSLT namespace. If you use this namespace, you must include the attribute version= "1. 0".

Start with an original XML document

We will now convert the following XML document ("cdcatalog.xml") to XHTML:

Empire BurlesqueBob DylanUSAColumbia10.901985..

View the XML file in Firefox and Internet Explorer: open the XML file (usually by clicking on a link)-the XML document displays the root and child elements in colored code. Click the plus sign (+) or minus sign (-) to the left of the element to expand or shrink the structure of the element. To view the original XML source file (without plus and minus signs), choose View Page Source Code or View Source Code from the browser menu.

View the XML file in Netscape 6: open the XML file, then right-click in the XML file and select View Page Source. The XML document displays the root element and child elements in a colored code.

View the XML file in Opera 7: open the XML file, then right-click in the XML file and select "frame" / "View Source Code". The XML document is displayed as plain text.

Create an XSL style sheet

Then create an XSL stylesheet ("cdcatalog.xsl") with the transformation template:

My CD CollectionTitleArtist links XSL stylesheets to XML documents

Add an XSL stylesheet reference to the XML document ("cdcatalog.xml"):

Empire BurlesqueBob DylanUSAColumbia10.901985..

If you are using a browser that is XSLT compliant, it will smoothly convert your XML to XHTML.

The original text is from: https://www.linuxprobe.com/linux-xslt-transform.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report