xml XLST模板,使用可扩展样式表语言转换格式化

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml XLST模板,使用可扩展样式表语言转换格式化相关的知识,希望对你有一定的参考价值。

<!-- Extensible Stylesheet Language Transformations (XLST) are a way to select and format data located within an XML node tree.

XLST usually use the file extention .xls, and usually use the xls namespace. The usual setup is an .xls file, and then putting a stylesheet reference line within the XML document to tell it to format it based on that document (similar to how you use an external CSS file and reference it in your HTML file) 
-->

<!-- You can start with an XML document like this, -->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="formattest.xsl"?>

<cats>
    <cat id="1">
        <name>Susumu</name>
        <color>black</color>
        <breed>big cat</breed>
        <weight units="pounds">15</weight>
        <eyecolor units="color">green</eyecolor>
    </cat>
    
    <cat id="2">
        <name>Thumbs</name>
        <color>grey</color>
        <breed>thumb cat</breed>
        <weight units="pounds">9</weight>
        <eyecolor units="color">blue</eyecolor>
    </cat>
    
    <cat id="3">
        <name>Mittens</name>
        <color>orange</color>
        <breed>shorthair</breed>
        <weight units="pounds">13</weight>
        <eyecolor units="color">green</eyecolor>
    </cat>
</cats>

<!-- and using an .xls file you can display the name element (or any element) in the browser like this:
Cat Name: Susumu

Cat Name: Thumbs

Cat Name: Mittens

-->

以上是关于xml XLST模板,使用可扩展样式表语言转换格式化的主要内容,如果未能解决你的问题,请参考以下文章

XSLT

XSLT教程

信步漫谈之XSLT—基础介绍

xml相关概念

浅谈XML注入

XML注入详解