Common knowledge of XSLT conversion XML (3)

Source: Internet
Author: User
Tags xslt

Today, we will introduce the use of <XSL: attribute> elements. Sometimes when we use XSLT to convert XML, we may need to generate form elements cyclically and dynamically, and

Specify the name or ID of different form elements based on an id value in the loop. In this case, the <XSL: attribute> element can be used.

Let's take a look at Microsoft's explanation of this element:

<XSL: attribute> element

Create an attribute node and attach it to the output element.

 

Use<XSL: attribute>You can perform the following operations to replace an attribute value template with an element:

    • Calculate the attribute name.

    • Use Conditions, templates, and attribute sets when generating attributes.

    • Add attributes<XSL: Copy>Or<XSL: Element>The element generated by the element.

Example:

< XSL: attribute
Name = "Attribute-name"
Namespace = "URI-reference" >
</ XSL: attribute >

 

< IMG >
< XSL: attribute Name = "Src" >
< XSL: value- Select = "Imagenames/imagename"   />
</ XSL: attribute >
</ IMG >

Output:

< IMG SRC = "Imagenames/imagename" />

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.