Original: A Egil refsnes translation: Atzie
Six. XSL filtering and querying
What should we do if we want to show only the XML data that satisfies certain criteria? Or the example code above, we just need to add parameters to the Select attribute of the Xsl:for-each element, like this:The logical choices for parameters are:= (equal To)=! (Not equal to)> greater than or equal
The same example as before (cd_catalog_sort.xsl):
You can test for yours
Sometimes, we might want XML documents to be output with some statistical information or something like numbers, and it's not easy to make use of the previous knowledge. Two new elements
Meaning: Computes a script expression, outputting a text string.
Grammar:
Property:
language── the name of the scripting language used, the available attributes are "JavaScript", "JScript", "VBScript", "VBS", and so on, and the default is "JScript".
Meaning: Declares a global variable or defines a fu
This period learns about XSL style methods for use with the select Properties of XSL elements
XML is like DHTML (Dynamic HTML), these nodes are all objects, and these objects are layered, starting from the root node to form a hierarchical clear tree structure, which forms the Document Object model DOM, which is based on the object's properties, method to achieve the purpose of accessing the control XML no
the conditions, true is returned"
$ Any $
Set operator. If any item in the Set meets the conditions, "true" is returned"
|
Set operator, returns the union of two sets
Example 1:
Find the name and e-mail of the person with "Web development" skills from his/her resume. Assume that the document structure is as follows:
.........
Find out the names of all persons with web development skills and e-mail's
Original: Jan Egil refsnes
Vi. XSL filtering and query
What should we do if we want to display only XML data that meets certain conditions? Or the above exampleCodeYou only need to add parameters to the select attribute of the XSL: For-each element. For example:
The logical options of parameters include:
= (Equal)
=! (Not equal)
Lt less
Gt greater than or equal
The same as the pr
Original: A Egil refsnes translation: Atzie
Five. The index of the XSL
How do I establish an XSL index if I need to arrange the display of the elements in a certain order?Let's take a look at the previous example, or the code:
...
When an XML document is converted into an HTML file, the index should be established at the same time. The easy way to do this is to add a order-by attribute to your for-each
|
Collection operator, which returns a union of two sets
Example one:
Look for the name and e-mail from your resume for people with "web development" skills. Suppose the document structure looks like this:
.........
The XSL document structure for the names and e-mail of all the people who have web development skills is found in the above-structured personal resume as follows:
Description
1.[]── Indicates the selection
Original: A Egil refsnes translation: Atzie
Seven. XSL Control statements
1. Conditional Statement If...thenXSL also has conditional statements (hehe ~ ~ Good, like the program language). The specific syntax is to add a xsl:if element, similar to this... some output ...
The example above is rewritten as:
2. Choose of XSLThe purpose of choose is to have multiple conditions, giving different display results. The specific syntax is to add a set of xs
Tutorial
Six. XSL filtering and querying
What should we do if we want to show only the XML data that satisfies certain criteria? Or the example code above, we just need to add parameters to the Select attribute of the Xsl:for-each element, like this:The logical choices for parameters are:= (equal To)=! (Not equal to)> greater than or equal
The same example as before (cd_catalog_sort.xsl):
You can test for yourself an
The copy and copy-of structures are used to copy nodes. The copy element only copies the current node without any nodes or attributes. But copy-of is all copied.
XSLT stylesheet 1
XML source codeOutputCompare Compare these constructs.View in HTMLCopy-:CompareThese constructs.Copy:Value-:Compare these constructs.
XSLT stylesheet Xmlns: XSL = 'HTTP: // www.w3.org/5o/#/transform'> Div > B > B >Div > Div > B > B > Div > Div > B > B > Di
Tutorials | control | statements
Seven. XSL Control statements
1. Conditional Statement If...thenXSL also has conditional statements (hehe ~ ~ Good, like the program language). The specific syntax is to add a xsl:if element, similar to this... some output ...
The example above is rewritten as:
2. Choose of XSLThe purpose of choose is to have multiple conditions, giving different display results. The specific syntax is to add a s
This issue introduces multiple XSL methods and properties for VBScript, JScript, to give full play to XML advantages, for
First, Absolutechildnumber
Meaning: Returns the ordinal number of a node relative to all its siblings, regardless of the name.
Syntax: Absolutechildnumber (node)
Parameters: node── object, to return the number of nodes.
Example:
1, assuming that the document structure is:
Absolutechildnumber (This.selectnodes ('/document/b
Use the rich built-in verification methods provided by validator to simplify struts development.A major benefit of the Struts framework is that it provides a built-in interface for verifying received form data. If any verification fails, the application will re-display the HTML form to correct invalid data. If the verification is successful, the process continues. The simple validation interface of the Struts framework reduces the headaches related to
Use the rich built-in verification methods provided by validator to simplify struts development.
A major benefit of the Struts framework is that it provides a built-in interface for verifying received form data. If any verification fails, the applicationProgramThe HTML form is re-displayed, so that invalid data can be corrected. If the verification is successful, the process continues. The simple validation interface of the Struts framework reduces
Commons-validator (1)
The commons-validator package is used to extract the validation rule program for reuse. This package can be used in struts or independently applied in any other application. You can customize the verification method using Java classes, or configure the verification method using regular expressions in the configuration file. It not only supports server-side verification, but also suppo
First, the parameter checkIn development often need to write some field validation code, such as field non-empty, field length limit, mailbox format verification, and so on, write these and business logic does not relate to the code of the personal feeling there are two problems:
Verification code tedious, repetitive labor
The code in the method looks verbose
Each time you want to see which parameter verification is complete, you need to go through the Verification logic code
1 defines the validator interface under the Com.opensymphony.xwork2.validator package.Public interface ValidatorValidator is divided into two main categories:Plain validators and fieldvalidators.The validators come in both different flavors:a) Plain Validators/non-field VALIDATORSB) fieldvalidatorsThis article mainly discusses the differences between the two validator
Role of XSL: Convert XML into HTML
The following is a part of the XML document:
...
Then, we use the following XSL file as an HTML template to convert XML data to an HTML file:
In the above Code, the XSL: For-each element is used to locate which elements in the XML document need to be displayed according to the following template. The select attribute is used to
This article mainly introduces how to judge the results of the validator. Here, let's look at how to implement a custom validator.
Goal
We want to implement a verification of the phone number of the validator, the use of the example or based on the previous article inside the example, that is, the user information entered the form page. We add a
css|xml| Display CSS (stacked style sheet) and XSL (extensible Style language) can define the display of XML files, what are the differences between these two ways and how they are used, which we will give in this article.
In an XML file, which is basically a custom tag, it's obvious that a browser doesn't understand the tags, and now the browser is just a parser for an XML file--as long as your XML file is well-formed, it shows you the file intact.
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.