Use custom functions in xslt
1. the xml file remains unchanged.
2. the xslt file should declare a namespace with two types of references. For select and non-select statements, add {}. Note that ""
3. Declare a class at will
4 The transform function should use an AddExtensionObject of argumentlist and specify the Namespace above (it will be associated)
------------------- 1 -----------------
---------------
Because the previous method XSLT needs to be imported directly inside the XML file, and the XML file used in the project is system generated, can only provide the path, but no way to rewrite the contents of the XML, so need to find a way to be able to external to the XML and XSLT together, so as to achieve the goal, It can also be applied to multiple XML files for easy management.
First on the code, the sys
Notes "Java and XSLT" reading notes
First, all XSLT processors must include four built-in template rules that are less prioritized than any other rule, so you can overwrite them by writing a new template rule to match the same style. The best way to understand the built-in rules is to set them up always in the background and apply these built-in rules if no other rule is found that matches one node.
Often see a user to ask some about PHP and XML, database combination of the use of posts, but also often see some beginners
Mix the PHP code with the HTML code, and then when the error can not find the error, the rush, I will give a big
Home about how to use XML technology to separate the HTML code from the PHP program, of course, there are many kinds of separation technology, such as Pear
's IT templates.
On the whole, personally think that using XML technology is the most convenient, not much
We know that XML+XSLT can be directly exported to XML-enabled browsers, such as IE more than 5.0, but we also have to consider that there are many browsers do not directly support XML, in this case, we need to convert the server to HTML output to the browser, This interim transitional approach may have to be used for some time.
Using JSP plus the Tablib identity Library, we can do this transformation.
The well-known open source project group Jakarta
We know that XML+XSLT can be directly exported to XML-enabled browsers, such as IE more than 5.0, but we also have to consider that there are many browsers do not directly support XML, in this case, we need to convert the server to HTML output to the browser, This interim transitional approach may have to be used for some time.
Using JSP plus the Tablib identity Library, we can do this transformation.
The well-known open source project group Jakarta
$db; Use just the $db object
Include_once ("xml/sql2xml.php"); To include Sql2xml in.
$sql 2xmlclass = new Xml_sql2xml ($DB); Instantiate the Sql2xml
$sql 2xmlclass->setencoding ("GB2312"); Set the type of transcoding for data
if (false = = $xmlstring) {//If the user passes in the array data, the array data is applied to the XSL
Set the node name for generating XML document data
$options = Array (tagnamerow => "Row",
Tagnameresult => "Result"
);
$sql 2xmlclass->setoptions ($options);
Add data t
When working with an XML file, you may experience a situation where the file contains sensitive data, and your favorite XML processing tool has a problem, such as a bug. You need to provide the vendor with a sample file that causes a bug. Of course, you can't send an XML file randomly because it may be a special tag in the sample file that is causing the problem. You need a way to clear sensitive data in a file while maintaining the special structural characteristics of the file so that you can
Don't underestimate this question. we generally understand it as follows: if you want to add a link, use the lt; a gt; Mark, for example, do not underestimate this question. we generally understand it as follows: if you want to add a link, use this mark. for example:
However, this syntax does not work because there are multiple double quotes that interfere with each other.
How can this problem be solved? Use the following syntax
Part 7: Dependency
Catego
Using PHP+XSLT on the Windows platform
1. Download PHP 4.0.6 to Http://www.php.net
2. Unzip the php-4.0.6-win32.zip into the c:\php
3. Configure PHP on the Web server
3. Copy the following four files under the DLLs directory to Windows\System (32)
Expat.dll
Sablot.dll
Xmlparser.dll
Xmltok.dll
4. Modify PHP.ini
Modify Extension_dir to point to the correct extension directory
Extension_dir = C:/php/extensions
and find the following line.
; Ext
Php, XML, XSLT, Mysql, and code .? Php (as the mainstream development language) require_onceDB.php (as the mainstream development language); database processing class dataTypeMySQL in PEAR (the best combination with PHP)
Require_once "DB. php (as the mainstream development language)"; // database processing class in PEAR
$ DataType = "MySQL (the best combination with PHP)"; // Database type
$ User = "root"; // user name
$ Pass = "abcd"; // password
$
1. How to Use call-template? How do I pass parameters and define return values?
A: The XSL: withparam element is used in the call-template field to define the parameters to be passed and the XSL: Param Parameter definition form parameter is defined in the called template.
2. How do I convert the input file namespace to the output file?
Use the XSL: namespace-alias element.
3. How does apply-templates select the template? Is it based on the element name, not the Template Name?
As follows:
I
1.
If the select result is null, nothing is actually done.
2. wildcards in xpath
Wildcard
Description
*
Match anyElement Node.
@*
Match any attribute node.
Node ()
MatchAny type of Node.
3.
The code above demonstrates how to insert variables and parameter values in the output document stream. The method is {$ name}
4. performance differences between call-template and apply-templates:
In terms of raw performance XSL:
The system-property () function is used to return the value of a system property. The string parameter specifies the name of the system attribute.
Syntax: system-property (string)
Parameter: string, required
Return Value: XPath expression
Example
Xml:
Xslt:
Result:
version:1vendor:vendor-url:
Current function, returns the current node, returns the node set containing only the current node
Syntax: current ()
Parameter: None
Return Value: Node Set
Example:
Xml:
Xslt:
Result:
Red
Green
Blue
The document (URL) function parses an external XML document (not an XML source document for conversion) into an XML node tree that can be directly referenced. The URL parameter specifies the physical address of the external XML document.
Syntax: document (URL)
Parameter: URL string, required
Return Value: Node Set
Example:
Document. xml:
Xml source document:
Xslt:
Result:
Blue is at 3.
When you encounter XML files similar to the following, You need to place the different months of each year under the nodes of the year. If you use the C # programming language, it is easy to implement, because there are not many XSLT files, it also took me a bit of thought.
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->The idea was to define a variable to record loops, but the assignment of the varia
Simplified version, from: http://stackoverflow.com/questions/982687/how-do-i-display-xml-using-an-xslt-document-in-a-delphi-app
Uses XMLDoc, XMLIntf;function Transform(XMLContent : string; XSLContent : string) : WideString;var XML : IXMLDocument; XSL : IXMLDocument;begin XML := LoadXMLData(XMLContent); XSL := LoadXMLData(XSLContent); XML.DocumentElement.TransformNode(XSL.DocumentElement, Result)end;
I tried it, but it is really easy to use, but
Generating HTM pages with XML and XSLT is what I always want to do,
After all, instead of making the ASPX page access the database every time it accesses the database, open the data connection, and close the data connection,
It is better to save data as an HTM static page.
I have been searching for this information on the Internet. I also went to msdn to look at the class library, one method and one method, and finally managed to gain a glimpse.Co
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.