Skip to Content
XSLT and XPATH: A Guide to XML Transformations
book

XSLT and XPATH: A Guide to XML Transformations

by John Robert Gardner, Zarella L. Rendon
July 2001
Intermediate to advanced
592 pages
11h 16m
English
Pearson
Content preview from XSLT and XPATH: A Guide to XML Transformations

6.6. Adding Attributes to LREs

Attributes can be added to LREs in three ways: by directly typing the attribute and its value in the LRE, by using the <xsl:attribute> element, or by using the <xsl:attribute-set> element in conjunction with either the use-attribute-sets on an element or xsl:use-attribute-sets attribute on an LRE. Because LREs are passed through to the output result tree, using attributes directly in LRE elements can be difficult if the value of the attribute is to be generated or extracted from some node-set in the input document. For example, if we wanted to output a new element called <newblock> instead of our <block>s in Markup City, and then add an attribute with the text content of the <block>, the template in Example 6-14 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning XSLT and XPath: Transforming XML Documents and Data

Beginning XSLT and XPath: Transforming XML Documents and Data

Ian Williams
Java and XSLT

Java and XSLT

Eric M. Burke
Learning XSLT

Learning XSLT

Michael Fitzgerald

Publisher Resources

ISBN: 0130404462Purchase book