`

xsl:attribute

    博客分类:
  • XML
阅读更多
xsl:attribute
创建一个属性节点和追加节点到输出节点中

Remarks
标签中的内容指名属性(attribute)的值
Attributes 能够追加或修改标签(element)的属性通过把 <xsl:attribute> 标签放到输出标签中。
如:
<input>
<xsl:attribute name="type">button</attribute>
</input>
注意:  <xsl:attribute> 可以放在输出标签中,不仅仅是<xsl:element>.
在子标签追加前所有的属性必须都被应用。
就是  <xsl:attribute>必须在字标签追加前


例子:
xml:

<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society.</description>
</book>
<book id="bk104">
<author>Corets, Eva</author>
<title>Oberon's Legacy</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-03-10</publish_date>
<description>In post-apocalypse England, the mysterious agent known only as Oberon helps to create a new life for the inhabitants of London. Sequel to Maeve Ascendant.</description>
</book>
<book id="bk105">
<author>Corets, Eva</author>
<title>The Sundered Grail</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-09-10</publish_date>
<description>The two daughters of Maeve, half-sisters, battle one another for control of England. Sequel to Oberon's Legacy.</description>
</book>
<book id="bk106">
<author>Randall, Cynthia</author>
<title>Lover Birds</title>
<genre>Romance</genre>
<price>4.95</price>
<publish_date>2000-09-02</publish_date>
<description>When Carla meets Paul at an ornithology conference, tempers fly as feathers get ruffled.</description>
</book>
<book id="bk107">
<author>Thurman, Paula</author>
<title>Splish Splash</title>
<genre>Romance</genre>
<price>4.95</price>
<publish_date>2000-11-02</publish_date>
<description>A deep sea diver finds true love twenty thousand leagues beneath the sea.</description>
</book>
<book id="bk108">
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price>4.95</price>
<publish_date>2000-12-06</publish_date>
<description>An anthology of horror stories about roaches, centipedes, scorpions and other insects.</description>
</book>
<book id="bk109">
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
<publish_date>2000-11-02</publish_date>
<description>After an inadvertant trip through a Heisenberg Uncertainty Device, James Salway discovers the problems of being quantum.</description>
</book>
<book id="bk110">
<author>O'Brien, Tim</author>
<title>Microsoft .NET: The Programming Bible</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-09</publish_date>
<description>Microsoft's .NET initiative is explored in detail in this deep programmer's reference.</description>
</book>
<book id="bk111">
<author>O'Brien, Tim</author>
<title>MSXML3: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-01</publish_date>
<description>The Microsoft MSXML3 parser is covered in detail, with attention to XML DOM interfaces, XSLT processing, SAX and more.</description>
</book>
<book id="bk112">
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>49.95</price>
<publish_date>2001-04-16</publish_date>
<description>Microsoft Visual Studio 7 is explored in depth, looking at how Visual Basic, Visual C++, C#, and ASP+ are integrated into a comprehensive development environment.</description>
</book>
</catalog>
xslt:


<xsl:stylesheet xml="http://www.w3.org/XML/1998/namespace" xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="book"> Title:
<!-- { expression } is shorthand -->
<input size="40" id="{@id}">
<!-- attributes are applied to the current parent element (i.e. 'input') -->
<xsl:attribute name="value">
<xsl:value-of select="title"/>
</xsl:attribute>
</input>
<br/>
</xsl:template>
</xsl:stylesheet>
分享到:
评论

相关推荐

    eclipse-testng 离线包下载

    &lt;xsl:output name="xhtml" method="xhtml" indent="yes" omit-xml-declaration="yes"/&gt; &lt;xsl:param name="testNgXslt.outputDir"/&gt; &lt;xsl:param name="testNgXslt.cssFile"/&gt; &lt;xsl:param name="testNgXslt....

    动易网站标签说明(电子书)

    &lt;XSL:ATTRIBUTE name="href"&gt; 19. &lt;XSL:VALUE-OF select="pe:GetNodePath('true',NodeID)" /&gt; 20. &lt;/XSL:ATTRIBUTE&gt;[更多]&lt;/A&gt; 21. &lt;/DIV&gt; 22. &lt;A&gt; 23. &lt;XSL:ATTRIBUTE name="href"&gt; 24. &lt;XSL:VALUE-OF select...

    XMl实用大全(资料全易学习)

    14.9.3 使用xsl:attribute将特性插入到输出文档中 476 14.9.4 定义特性集合 477 14.9.5 使用xsl:pi生成处理指令 478 14.9.6 使用xsl:comment生成注释 478 14.9.7 使用xsl:text生成文本 479 14.10 使用xsl:copy复制...

    xml实用大全和轻松学习手册和无废话xml

    14.9.3 使用xsl:attribute将特性插入到输出文档中 476 14.9.4 定义特性集合 477 14.9.5 使用xsl:pi生成处理指令 478 14.9.6 使用xsl:comment生成注释 478 14.9.7 使用xsl:text生成文本 479 14.10 使用xsl:copy复制...

    XML实用大全(web开发必备手册)

    第5章 属性、空标记和XSL. 86 5.1 属性... 86 5.2 属性与元素的对比... 95 5.2.1 结构化的元数据... 95 5.2.2 元元数据... 99 5.2.3 有关元数据的说明... 100 5.2.4 元素更具扩展性... 100 5.2.5 使用属性的...

    XML实用大全----xml详细参考书

    第5章 属性、空标记和XSL. 86 5.1 属性... 86 5.2 属性与元素的对比... 95 5.2.1 结构化的元数据... 95 5.2.2 元元数据... 99 5.2.3 有关元数据的说明... 100 5.2.4 元素更具扩展性... 100 5.2.5 使用属性的...

    XML编程综合资料库

    第5章 属性、空标记和XSL. 86 5.1 属性... 86 5.2 属性与元素的对比... 95 5.2.1 结构化的元数据... 95 5.2.2 元元数据... 99 5.2.3 有关元数据的说明... 100 5.2.4 元素更具扩展性... 100 5.2.5 使用属性的...

    XML实用大全

    28 2.2.1 XSL. 28 2.2.2 XLL. 28 2.2.3 DCD.. 29 2.3 XML的后台应用... 30 2.4 本章小结... 33 第3章 第一个XML文档... 34 3.1 Hello XML. 34 3.1.1 创建一个简单的XML文档... 34 3.1.2...

    ElemWhen.rar_Linux/Unix编程_Unix_Linux_

    Each xsl:when element has a single attribute

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part4

    18.4.2 attribute指令 556 18.4.3 variable指令 557 18.5 标签文件实例讲解 558 18.5.1 实例一:[welcome]标签 558 18.5.2 实例二:[tohtml]标签 559 18.6 [jsp:invoke]动作元素 561 18.7 [jsp:dobody]动作...

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part3

    18.4.2 attribute指令 556 18.4.3 variable指令 557 18.5 标签文件实例讲解 558 18.5.1 实例一:[welcome]标签 558 18.5.2 实例二:[tohtml]标签 559 18.6 [jsp:invoke]动作元素 561 18.7 [jsp:dobody]动作...

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part2

    18.4.2 attribute指令 556 18.4.3 variable指令 557 18.5 标签文件实例讲解 558 18.5.1 实例一:[welcome]标签 558 18.5.2 实例二:[tohtml]标签 559 18.6 [jsp:invoke]动作元素 561 18.7 [jsp:dobody]动作...

    JAVA WEB 开发详解:XML+XSLT+SERVLET+JSP 深入剖析与实例应用.part5

    18.4.2 attribute指令 556 18.4.3 variable指令 557 18.5 标签文件实例讲解 558 18.5.1 实例一:[welcome]标签 558 18.5.2 实例二:[tohtml]标签 559 18.6 [jsp:invoke]动作元素 561 18.7 [jsp:dobody]动作...

    office密码工具

    xsl保护密码清除代码,打开宏将代码贴进去就执行就可以了Attribute VB_Name = "模块1" Private Function AllInternalPasswords() Dim w1 As Worksheet, w2 As Worksheet Dim i As Integer, j As Integer, k As ...

    Struts2 国际化字符串 拦截器

    人心的功能,如将Action输出到FreeMaker模板、Velocity模板、JasperReports和使用XSL转换等。这些都过result里的type(类型)属性(Attribute)定义的。另外,您还可以自定义result类型。 下面让我们来做一个...

    net学习笔记及其他代码应用

    1. 简述 private、 protected、 public、 internal 修饰符的访问权限。 答 . private : 私有成员, 在类的内部才可以访问。 protected : 保护成员,该类内部和继承类中可以访问。 public : 公共成员,完全公开,...

    Professional C# 3rd Edition

    Custom Attribute Example: WhatsNewAttributes 262 Reflection 265 The System.Type Class 266 The TypeView Example 268 The Assembly Class 271 Completing the WhatsNewAttributes Sample 272 Summary 276 ...

    arcgis工具

    11. 连接外界属性数据(如:.xsl文件等) 利用JOIN 工具可以方便的实现与外界属性数据的关联,但这种关联是依赖于外界数据库本身的,需经过重新导出之后即完全保存在相应图层属性页。在做外联如EXCEL等的时候对数据...

    opensc-0.12.0.tar.gz

    * OpenSC now depends on xsltproc utility and docbook-xsl to build docs and man * Remove iconv dependency. EstEID driver now uses the commonName from the certificate for card label. * Possibility to ...

    编译的 HTML 帮助文件 (.chm) DHTML手册

    XSLDocument 获取对 XSL 文档的顶层结点的引用。 属性 集合 集合 描述 all 返回对象所包含的元素集合的引用。 anchors 获取所有带有 name 和/或 id 属性的 a 对象的集合。此集合中的对象以 HTML 源顺序...

Global site tag (gtag.js) - Google Analytics