- 浏览: 1884746 次
- 性别:
- 来自: 合肥
文章分类
- 全部博客 (514)
- OPEN (41)
- WARN (33)
- EXPER (16)
- RESOURCE (7)
- TOOL (4)
- DWR (10)
- Struts1.x (10)
- Ibtais (18)
- MyEclipse (30)
- Sql Server (64)
- Tomcat (7)
- APACHE (4)
- JSP (18)
- SERVLET (6)
- ENGLISH (0)
- ECSide (8)
- JasperReports (7)
- JAVA (24)
- JS (42)
- XML (26)
- CVS (8)
- Mind (1)
- JQUERY (2)
- IBATIS (6)
- PROJECT (0)
- STRUTS2 (0)
- PROXOOL (0)
- SPRING (4)
- Hibernate (0)
- SSI (0)
- JBPM (11)
- FLEX (3)
- JSON (2)
- GWT (1)
- jeecms v3 (1)
- Flash (2)
- DATA (1)
- ORACLE (3)
- 查询oracle 中逗号分隔字符串中所有值 (1)
最新评论
-
小小西芹菜:
GoEasy web三步轻松实现web实时推送1. 引入goe ...
服务器推送技术 java -
kg_1997:
这个方法太棒了,可以不用to_date函数,实在是棒!!!
java/oracle日期处理 -
wodesunday:
:idea:
SQL的分段统计查询语句 -
wodesunday:
引用
SQL的分段统计查询语句 -
BlueSkator:
讲的有点浅,没有深入进去
tomcat需要的重新发布和重启服务器的几种情况
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>
创建一个属性节点和追加节点到输出节点中
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>
发表评论
-
XSTL接触
2011-04-27 15:39 2835XSTL接触 07月 11th, 2006 by 城市刀客 ... -
unknown protocol: c 解决方法,致命错误:“无法编译样式表”
2010-11-26 10:03 4711在使用XSLTransformer解析xml样式表,出现 u ... -
模板存储和解析。
2010-11-16 16:41 1211表单建模或者权限页面显示原理基本使用模板存储和解析 采用XML ... -
xml To html
2010-10-11 15:34 1206import java.io.*; import java.u ... -
(四)XPath 实例
2010-10-11 14:10 1374XPath 实例 Previous Page Next Pag ... -
(三)XPath Axes(坐标轴)
2010-10-11 13:53 1144XML 实例文档 我们将在 ... -
(二)XPath 语法
2010-10-11 13:41 923XPath 使用路径表达式来选取 XML 文档中的节点或节点集 ... -
XPath 术语(一)
2010-10-11 13:40 970XPath 术语 节点(Node) ... -
XSLT中用normalize-space函数来清除元素的前后空格
2010-10-11 13:30 1905XSLT中用normalize-space函数来清除元素的前后 ... -
java编写xsl转换器(xslt)把xml文件转换为html文件2
2010-10-11 10:41 1624//Prints formatted representati ... -
XSLT - 客户端
2010-10-11 09:14 883如果您的浏览器支持 XSLT,那么在浏览器中它可被用来将文档转 ... -
XSLT <xsl:apply-templates> 元素
2010-10-11 09:10 1285<xsl:apply-templates> 元素可 ... -
XSLT <xsl:choose> 元素
2010-10-11 09:05 1212XSLT <xsl:choose> 元素 Prev ... -
XSLT <xsl:if> 元素
2010-10-11 09:04 1247XSLT <xsl:if> 元素 Prev ... -
XSLT <xsl:sort> 元素
2010-10-11 09:02 1763XSLT <xsl:sort> 元素 Previo ... -
XSLT <xsl:for-each> 元素
2010-10-11 09:02 1579XSLT <xsl:for-each> 元素 Pr ... -
XSLT <xsl:value-of> 元素
2010-10-11 09:01 1166XSLT <xsl:value-of> 元素 Pr ... -
XSLT 元素 (一)
2010-10-08 15:09 1000XSLT 元素 XSL 样式表由 ... -
java编写xsl转换器(xslt)把xml文件转换为html文件
2010-10-08 14:32 4514package xslt; import java.io ... -
jdom常用方法封装
2010-02-06 10:22 1548import java.io.*; import javax ...
相关推荐
`<xsl:attribute>` 元素用于在结果树中创建属性。它可以用来向新创建的元素添加属性,或修改现有元素的属性。 **语法:** ```xml <xsl:attribute name="string"> expression </xsl:attribute> ``` 或 ```xml <xsl:...
- **语法**:`<xsl:attribute name="string">string</xsl:attribute>` - **属性**: - `name`:必需,用于指定属性名。 - **示例**: ```xml <xsl:template match="book"> <xsl:attribute name="price"> ...
在本案例中,我们将探讨如何使用XSLT中的`<xsl:element>`和`<xsl:attribute>`指令来生成元素和添加属性,以实现XML文档的转换。 首先,`<xsl:element>`指令用于动态创建元素。例如,以下代码会生成一个名为"a"的...
<xsl:attribute name="href"> <xsl:value-of select="./@href"/> </xsl:attribute> <xsl:value-of select="."/> </xsl:element> ``` 上述代码将创建一个新的`<a>`标签,并将其`href`属性设置为当前节点的`href`...
- `<xsl:attribute-set name="...">...</xsl:attribute-set>` - **属性**: - `name`:必需属性,指定属性集的名称。 - **示例**: - 定义一个包含多个属性的属性集: ```xml <xsl:attribute-set name=...
<xsl:attribute name="name"><xsl:value-of select="$ctrlname"/></xsl:attribute> <xsl:attribute name="value"> <xsl:choose> <xsl:when test="contains($str,',')"><xsl:value-of select="substring-before($...
`<xsl:attribute name="name">content</xsl:attribute>` 其中`name`属性指定属性的名称,而`content`则是在输出文档中将作为属性值的内容。 #### 例子 假设我们要为每个`item`元素生成一个`id`属性,可以使用以下...
<xsl:attribute name="height"><xsl:value-of select="'0.5in'"/></xsl:attribute> <xsl:call-template name="barcode"> <xsl:with-param name="code" select="'1234567890'"/> <xsl:with-param name="type" ...
<xsl:output name="xhtml" method="xhtml" indent="yes" omit-xml-declaration="yes"/> <xsl:param name="testNgXslt.outputDir"/> <xsl:param name="testNgXslt.cssFile"/> <xsl:param name="testNgXslt....
2. 学会使用XSLT添加属性指令:XSLT还允许我们通过`<xsl:attribute>`指令来添加或修改元素的属性。在这里,我们将使用这个功能为生成的序号元素添加超链接,使其成为一个指向详细信息页面的URL。 具体实现步骤可能...
### XSLT 元素详解 #### <xsl:apply-imports> ...接下来,我们将继续深入探讨其他 XSLT 元素,包括但不限于 `<xsl:attribute>`、`<xsl:attribute-set>` 等,进一步了解这些元素如何协同工作以实现复杂的数据转换任务。
<xsl:attribute name="style">background-color: #ff00ff;</xsl:attribute> </xsl:if> <xsl:value-of select="artist"/> ... </xsl:template> </xsl:stylesheet> ``` 这个模板会将XML文档转换为HTML表格,...
<xsl:attribute name="class">green</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="class">blue</xsl:attribute> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:...
### XSLT 元素使用说明 ...接下来的章节将详细介绍更多XSLT元素,包括但不限于`<xsl:attribute>`、`<xsl:template>`等。这些元素共同构成了XSLT语言的核心,使得开发者能够在处理XML数据时具有更大的灵活性和效率。
<XSL:ATTRIBUTE name="href"> 19. <XSL:VALUE-OF select="pe:GetNodePath('true',NodeID)" /> 20. </XSL:ATTRIBUTE>[更多]</A> 21. </DIV> 22. <A> 23. <XSL:ATTRIBUTE name="href"> 24. <XSL:VALUE-OF select...
<xsl:attribute name="id"> <xsl:value-of select="@name"/> </xsl:attribute> <xsl:value-of select="@name"/> <xsl:apply-templates select="folder | file"/> </xsl:template> <xsl:template match=...
2. **xsl:attribute** 创建一个新的属性节点并附加到当前元素上。name属性指定了新属性的名称。 3. **xsl:cdata-section** 在输出中创建一个CDATA区段,常用于包含不会被解析器处理的特殊字符或标记。 4. **...
<xsl:attribute name="src">../FTP_Magazine/FTP_Issue/<xsl:value-of select="@url"/></xsl:attribute> <xsl:apply-templates/> </xsl:template> </xsl:stylesheet> ``` 在XSL文件中查找...
- `xsl:attribute-set`:定义可重用的属性集。 **6. XSLT的高级特性** - `xsl:namespace-alias`:为不同的命名空间提供别名。 - `xsl:key`:创建索引,用于高效地查找和分组节点。 - `xsl:sort`:对节点集进行排序...
`xsl:a`用于创建链接,`xsl:attribute`用于添加自定义属性,而`xsl:element`则用于动态创建元素。 在实现“XLST小应用”的过程中,我们需要将XML数据的结构映射到参考说明书的结构上。例如,产品信息可能对应于...