XML referentiemanual
- Vorige pagina XSD variabelen
- Volgende pagina DOM knooppunttypen
XML referentiemanual
Node type
The following table lists different W3C node types and the child elements they can have:
Node type | Description | Child elements |
---|---|---|
Document | Represents the entire document (the root node of the DOM tree) |
|
DocumentFragment | Represents a lightweight Document object that contains part of the document. |
|
DocumentType | Provides an interface to the entity defined for the document. | None |
ProcessingInstruction | Represents a processing instruction. | None |
EntityReference | Represents an entity reference element. |
|
Element | Represents an element (element) element |
|
Attr | Represents an attribute. |
|
Text | Represents the text content in an element or attribute. | None |
CDATASection | Represents a CDATA section in the document (text is not parsed by the parser) | None |
Comment | Represents a comment. | None |
Entity | Represents an entity. |
|
Notation | Represents a symbol declared in the DTD. | None |
Node type - Return value
The following table lists the values that the nodeName and nodeValue properties can return for each node type:
Node type | Return value of nodeName | Return value of nodeValue |
---|---|---|
Document | #document | null |
DocumentFragment | #document fragment | null |
DocumentType | doctype name | null |
EntityReference | Entity reference name | null |
Element | element name | null |
Attr | Attribute name | Attribute value |
ProcessingInstruction | target | Content of the node |
Comment | #comment | Comment text |
Text | #text | Node Content |
CDATASection | #cdata-section | Node Content |
Entity | Entity Name | null |
Notation | Symbol Name | null |
NodeTypes - Named Constants
NodeType | Named Constant |
---|---|
1 | ELEMENT_NODE |
2 | ATTRIBUTE_NODE |
3 | TEXT_NODE |
4 | CDATA_SECTION_NODE |
5 | ENTITY_REFERENCE_NODE |
6 | ENTITY_NODE |
7 | PROCESSING_INSTRUCTION_NODE |
8 | COMMENT_NODE |
9 | DOCUMENT_NODE |
10 | DOCUMENT_TYPE_NODE |
11 | DOCUMENT_FRAGMENT_NODE |
12 | NOTATION_NODE |
XML DOM Node-object
Properties of Node object
Property | Description |
---|---|
attributes | NamedNodeMap containing the properties of this node (if this node is an element). |
baseURI | Return the absolute base URI of the node. |
childNodes | Return the NodeList of child nodes of the node. |
firstChild | Return the first child node of the node. |
lastChild | Return the last child node of the node. |
nextSibling | Return the same-level node immediately following the node. |
nodeName | Geef de naam van het knooppunt terug, afhankelijk van het type. |
nodeType | Geef het type van het knooppunt terug. |
nodeValue | Stel in of geef de waarde van het knooppunt terug, afhankelijk van het type. |
ownerDocument | Return the root element of the node (document object). |
parentNode | Return the parent node of the node. |
prefix | Set or return the namespace prefix of the node. |
previousSibling | Return the same-level node immediately preceding the node. |
textContent | Set or return the text content of the node and its descendants. |
Methods of Node object
Methode | Description |
---|---|
appendChild() | Append a new child node to the end of the node's child node list. |
cloneNode() | Clone the node. |
compareDocumentPosition() | Compare the position of two nodes in the DOM hierarchy (document). |
getFeature()feature,version) | Returnt a DOM object that implements the specialized API for the specified feature and version. |
getUserData()key) |
Return the object associated with the key on the node. The object must be set to this node first, by calling setUserData with the same key. |
hasAttributes() | Return true if the specified node has any attributes, otherwise return false. |
hasChildNodes() | Return true if the specified node has child nodes, otherwise return false. |
insertBefore() | Insert a new child node before the specified child node. |
isDefaultNamespace(URI) | Return whether the specified namespace URI is the default. |
isEqualNode() | Check if two nodes are equal. |
isSameNode() | Check if two nodes are the same node. |
lookupNamespaceURI() | Return the namespace URI associated with the given prefix. |
lookupPrefix() | Return the prefix associated with the given namespace URI. |
normalize() | Merge adjacent text nodes and delete empty text nodes. |
removeChild() | Delete (and return) the specified child node of the current node. |
replaceChild() | Replace the child node with a new node. |
setUserData(key,data,handler) | Associate the object with the key on the node. |
XML DOM NodeList-object
Properties of NodeList object
Property | Description |
---|---|
length | Return the number of nodes in the NodeList. |
Methods of NodeList object
Methode | Description |
---|---|
item() | Return the node at the specified index in the NodeList. |
XML DOM NamedNodeMap-object
Eigenschappen van het NamedNodeMap object
Property | Description |
---|---|
length | Retourneer het aantal knooppunten in de lijst. |
Methoden van het NamedNodeMap object
Methode | Description |
---|---|
getNamedItem() | Retourneer het knooppunt met een specifieke naam. |
getNamedItemNS() | Retourneer het knooppunt met een specifieke naam en namespace. |
item() | Retourneer het knooppunt op de gespecificeerde index. |
removeNamedItem() | Verwijder een knooppunt met een specifieke naam. |
removeNamedItemNS() | Verwijder een knooppunt met een specifieke naam en namespace. |
setNamedItem() | Stel een gespecificeerd knooppunt in (op basis van naam). |
setNamedItemNS() | Stel een gespecificeerd knooppunt in (op basis van naam en namespace). |
XML DOM Document-object
Eigenschappen van het Document object
Property | Description |
---|---|
childNodes | Retourneer de NodeList van de subknooppunten van het document. |
doctype | Retourneer de documenttypeverklaring die geassocieerd is met het document. |
documentElement | Retourneer de root knooppunt van het document. |
documentURI | Stel in of retourneer de positie van het document. |
domConfig | Retourneer de configuratie die gebruikt wordt bij het aanroepen van normalizeDocument(). |
firstChild | Retourneer het eerste subknooppunt van het document. |
implementation | Retourneer het DOMImplementation object dat dit document verwerkt. |
inputEncoding | Retourneer de encoding die het document gebruikt (bij het parseren). |
lastChild | Retourneer de laatste subknooppunt van het document. |
nodeName | Retourneer de naam van het knooppunt (afhankelijk van zijn type). |
nodeType | Retourneer het knooppunttype van het knooppunt. |
nodeValue | Stel in of retourneer de waarde van het knooppunt (afhankelijk van zijn type). |
xmlEncoding | Retourneer de XML encoding van het document. |
xmlStandalone | Stel in of retourneer of het document onafhankelijk is. |
xmlVersion | Stel in of retourneer de XML versie van het document. |
Methoden van het Document object
Methode | Description |
---|---|
adoptNode() | Neem een knooppunt van een ander document op in dit document op, en retourneer het opgenomen knooppunt. |
createAttribute() | Maak een eigenschapsknooppunt aan met een gespecificeerde naam, en retourneer het nieuwe Attr object. |
createAttributeNS() | Maak een eigenschapsknooppunt aan met een gespecificeerde naam en namespace, en retourneer het nieuwe Attr object. |
createCDATASection() | Maak een CDATA sectie knooppunt aan. |
createComment() | Maak een commentaar knooppunt aan. |
createDocumentFragment() | Maak een lege DocumentFragment object aan en retourneer het. |
createElement() | Create an element node. |
createElementNS() | Create an element node with the specified namespace. |
createEntityReference() | Create an EntityReference object and return this object. |
createProcessingInstruction() | Create a ProcessingInstruction object and return this object. |
createTextNode() | Create a text node. |
getElementById() | Return the element with the id attribute having the given value. |
getElementsByTagName() | Return a NodeList of all elements with the specified name. |
getElementsByTagNameNS() | Return a NodeList of all elements with the specified name and namespace. |
importNode() | Import a node from another document to this document. |
normalizeDocument() | |
renameNode() | Rename an element node or an attribute node. |
Properties of the DocumentType object
Each document has a DOCTYPE attribute, whose value is null or a DocumentType object.
The DocumentType object provides an interface for the entities defined for the XML document.
Property | Description |
---|---|
name | Return the name of the DTD. |
publicId | Return the public identifier of the DTD. |
systemId | Return the system identifier of the external DTD. |
Methods of the DocumentImplementation object
The DOMImplementation object performs operations that are independent of any specific instance of the Document Object Model.
Methode | Description |
---|---|
createDocument() | Create a new DOM Document object with the specified document type. |
createDocumentType() | Create an empty DocumentType node. |
getFeature() | Return the object of the API that implements the specified feature and version (if any). |
hasFeature() | Check if the DOM implementation has implemented a specific feature and version. |
Properties of the ProcessingInstruction object
The ProcessingInstruction object represents a processing instruction.
Processing instructions are used as a method to retain processor-specific information in the XML document text.
Property | Description |
---|---|
data | Set or return the content of the processing instruction. |
target | Return the target of the processing instruction. |
XML DOM Element-object
Properties of the Element object
Property | Description |
---|---|
attributes | Return the NamedNodeMap of the element's attribute. |
baseURI | Returnt the absolute base URI of the element. |
childNodes | Returnt the NodeList of child nodes of the element. |
firstChild | Returnt the first child element of the element. |
lastChild | Returnt the last child element of the element. |
localName | Returnt the local part of the element name. |
namespaceURI | Returnt the namespace URI of the element. |
nextSibling | Returnt the node immediately following the element. |
nodeName | Returnt the name of the node, depending on its type. |
nodeType | Geef het type van het knooppunt terug. |
ownerDocument | Returnt the root element (document object) of the node. |
parentNode | Returnt the parent node of the element. |
prefix | Set or return the namespace prefix of the element. |
previousSibling | Returnt the node immediately preceding the element. |
schemaTypeInfo | Returnt the type information associated with the element. |
tagName | Returnt the name of the element. |
textContent | Set or return the text content of the element and its descendants. |
Methoden van het Element object
Methode | Description |
---|---|
appendChild() | Add a new child node to the end of the node's child node list. |
cloneNode() | Clone the node. |
compareDocumentPosition() | Compare the document position of two nodes. |
getAttribute() | Returnt the value of the attribute. |
getAttributeNS() | Returnt the value of the attribute (with namespace). |
getAttributeNode() | Returnt attribute nodes as Attribute objects. |
getAttributeNodeNS() | Returnt attribute nodes (with namespace) as Attribute objects. |
getElementsByTagName() | Returnt a NodeList of matching element nodes and their child nodes. |
getElementsByTagNameNS() | Returnt a NodeList of matching element nodes (with namespace) and their child nodes. |
getFeature()feature,version) | Returnt a DOM object that implements the specialized API for the specified feature and version. |
getUserData()key) | Returnt the object associated with the key on the node. The object must first be set to this node by calling setUserData with the same key. |
hasAttribute() | Returnt whether the element has an attribute that matches the specified name. |
hasAttributeNS() | Returnt whether the element has an attribute that matches the specified name and namespace. |
hasAttributes() | Returnt whether the element has attributes. |
hasChildNodes() | Returnt of de element of er een kindnode heeft. |
insertBefore() | Insert a new child node before the existing child nodes. |
isDefaultNamespace(URI) | Return whether the specified namespaceURI is the default. |
isEqualNode() | Check if two nodes are equal. |
lookupNamespaceURI() | Return the namespace URI that matches the specified prefix. |
lookupPrefix() | Return the prefix that matches the specified namespace URI. |
normalize() |
The normalize() method removes empty text nodes and connects adjacent text nodes. Normalize all text nodes under the element (including attributes), where only structure (such as elements, comments, processing instructions, CDATA sections, and entity references) separates text nodes. That is, there are no adjacent text nodes, nor empty text nodes. |
removeAttribute() | Delete the specified attribute. |
removeAttributeNS() | Delete the specified attribute (with namespace). |
removeAttributeNode() | Delete the specified attribute node. |
removeChild() | Delete the child node. |
replaceChild() | Replace the child node. |
setUserData(key,data,handler) | Associate the object with the key on the element. |
setAttribute() | Add a new attribute. |
setAttributeNS() | Add a new attribute (with namespace). |
setAttributeNode() | Add a new attribute node. |
setAttributeNodeNS(attrnode) | Add a new attribute node (with namespace). |
setIdAttribute(name,isId) | If the isId attribute of the Attribute object is true, this method declares the specified attribute as a user-defined ID attribute. |
setIdAttributeNS(uri,name,isId) | If the isId attribute of the Attribute object is true, this method declares the specified attribute (with namespace) as a user-defined ID attribute. |
setIdAttributeNode(idAttr,isId) | If the isId attribute of the Attribute object is true, this method declares the specified attribute as a user-defined ID attribute. |
Attributes of the Attr object
Property | Description |
---|---|
baseURI | Return the absolute base URI of the attribute. |
isId | If the attribute is of type id, return true, otherwise return false. |
localName | Return the local part of the attribute name. |
name | Return the name of the attribute. |
namespaceURI | Return the namespace URI of the attribute. |
nodeName | Geef de naam van het knooppunt terug, afhankelijk van het type. |
nodeType | Geef het type van het knooppunt terug. |
nodeValue | Stel in of geef de waarde van het knooppunt terug, afhankelijk van het type. |
ownerDocument | Geef de wortelelement (documentobject) van het attribuut terug. |
ownerElement | Geef het elementknooppunt dat het attribuut beheert terug. |
prefix | Stel in of geef de naamruimteprefix van het attribuut terug. |
schemaTypeInfo | Geef de typeinformatie die met het attribuut is geassocieerd terug. |
specified |
Geef true terug als de waarde van het attribuut in het document is ingesteld; Geef false terug als de waarde van het attribuut de standaardwaarde in DTD/Schema is; |
textContent | Stel in of geef de tekstinhoud van de eigenschap terug. |
value | Stel in of geef de waarde van de eigenschap terug. |
XML DOM Text-object
Eigenschappen van het Text-object
Property | Description |
---|---|
data | Stel in of geef de tekst van het element of de eigenschap terug. |
isElementContentWhitespace | Beoordeel of de tekstknoop blanco karakters bevat. |
length | Geef de tekstlengte van het element of de eigenschap terug. |
wholeText | Geef alle tekst van de aanliggende tekstknooppunten naast dit knooppunt terug, verbonden in de volgorde van het document. |
Methoden van het Text-object
Methode | Description |
---|---|
appendData() | Voeg gegevens toe aan het einde van het knooppunt. |
deleteData() | Verwijder gegevens uit het knooppunt. |
insertData() | Voeg gegevens toe aan het knooppunt. |
replaceData() | Vervang de gegevens in het knooppunt. |
replaceWholeText(text) | Vervang de tekst van dit knooppunt en alle aanliggende tekstknooppunten met de gespecificeerde tekst. |
splitText() | Splits een Text-knoop in twee. |
substringData() | Haal gegevens uit het knooppunt. |
XML DOM CDATASection-object
Eigenschappen van het CDATASection-object
Property | Description |
---|---|
data | Stel in of geef de tekst van dit knooppunt terug. |
length | Geef de lengte van het CDATA-deel terug. |
Methoden van het CDATASection-object
Methode | Description |
---|---|
appendData() | Voeg gegevens toe aan het einde van het knooppunt. |
deleteData() | Verwijder gegevens uit het knooppunt. |
insertData() | Voeg gegevens toe aan het knooppunt. |
replaceData() | Vervang de gegevens in het knooppunt. |
splitText() | Splits de CDATA-knoop in twee knopen. |
substringData() | Haal gegevens uit het knooppunt. |
XML DOM Comment-object
Eigenschappen van het Commentaar-object
Property | Description |
---|---|
data | Stel in of geef de tekst van dit knooppunt terug. |
length | Geef de tekstlengte van dit knooppunt terug. |
Methoden van het Commentaar-object
Methode | Description |
---|---|
appendData() | Voeg gegevens toe aan het einde van het knooppunt. |
deleteData() | Verwijder gegevens uit het knooppunt. |
insertData() | Voeg gegevens toe aan het knooppunt. |
replaceData() | Vervang de gegevens in het knooppunt. |
substringData() | Haal gegevens uit het knooppunt. |
XML DOM XMLHttpRequest-object
Methoden van het XMLHttpRequest-object
Methode | Description |
---|---|
abort() | Annuleer het huidige verzoek. |
getAllResponseHeaders() | Geef de headerinformatie terug. |
getResponseHeader() | Geef de waarde van de gespecificeerde HTTP responskop aan. |
open(method,url,async,uname,pswd) |
Specificeer het type van de verzoek, de URL, of de verzoek asynchrone verwerking moet worden uitgevoerd, evenals andere optionele eigenschappen van het verzoek.
|
send(string) |
Send the request to the server. string: Only for POST requests |
setRequestHeader() | Add a label/value pair to the headers to be sent. |
XMLHttpRequest object properties
Property | Description |
---|---|
onreadystatechange | Store the function (or function name) that is automatically called each time the readyState attribute changes. |
readyState |
Save the XMLHttpRequest status. Changes from 0 to 4:
|
responseText | Return response data as a string. |
responseXML | Return response data in XML format. |
status | Return the status code (e.g., "404" for "Not Found", or "200" for "OK"). |
statusText | Return status text (e.g., "Not Found" or "OK"). |
XSD elements
Specificeer dat de waarde van een eigenschap of element (of een combinatie van eigenschappen of elementen) binnen een bepaald bereik uniek moet zijn.
Zie XSD beperkingen / Facetten
Beperk | Description |
---|---|
enumeration | Definieer een lijst van aanvaardbare waarden. |
fractionDigits | Definieer het maximale aantal decimalen dat toegestaan is. Dit moet groter of gelijk zijn aan 0. |
length | Definieer het exacte aantal toegestane tekens of items in een lijst. Dit moet groter of gelijk zijn aan 0. |
maxExclusive | Definieer het bovengrens van een getal. De toegestane waarden moeten kleiner zijn dan deze waarde. |
maxInclusive | Definieer het bovengrens van een getal. De toegestane waarden moeten kleiner of gelijk zijn aan deze waarde. |
maxLength | Definieer het maximale aantal toegestane tekens of items in een lijst. Dit moet groter of gelijk zijn aan 0. |
minExclusive | Definieer het onderste limiet van een getal. De toegestane waarden moeten groter zijn dan deze waarde. |
minInclusive | Definieer het onderste limiet van een getal. De toegestane waarden moeten groter of gelijk zijn aan deze waarde. |
minLength | Definieer het minimumaantal toegestane tekens of lijstitems. Moet groter of gelijk aan 0 zijn. |
pattern | Definieer de nauwkeurige reeks van toegestane tekens. |
totalDigits | Definieer het aantal nauwkeurige cijfers van de toegestane Arabische cijfers. Moet groter zijn dan 0. |
whiteSpace | Definieer de verwerking van witruimte (reepjes, return, spaties en tabtasten). |
XSLT-element
element | Description |
---|---|
apply-imports | Wend de sjabloonregels van de geïmporteerde stijltabel toe. |
apply-templates | Wend een sjabloon toe aan het huidige element of de subelementen van het huidige element. |
attribute | Voeg een eigenschap toe aan het element. |
attribute-set | Maak een genaamd attribuutensemble. |
call-template | Roep een gespecificeerde sjabloon aan. |
choose | Gebruik samen met <when> en <otherwise> om meervoudige conditietests uit te drukken. |
comment | Maak een opmerkingknoop aan in het resultaatboom. |
copy | Maak een kopie van de huidige knoop (zonder subknopen en eigenschappen). |
copy-of | Maak een kopie van de huidige knoop (met subknopen en eigenschappen). |
decimal-format | Definieer de tekens en symbolen die moeten worden gebruikt bij het omzetten van cijfers naar strings met de format-number() functie. |
element | Maak een elementknoop aan in het uitvoerdocument. |
fallback | Als de processor een XSLT-element niet ondersteunt, stel een alternatieve code in om te draaien. |
for-each | Bespreek elke knoop in de gespecificeerde knooppool. |
if | Bevat een sjabloon, alleen wanneer een gespecificeerde conditie成立. |
import | Gebruikt om de inhoud van een stijltabel in een andere stijltabel in te voegen. |
include | Inclusief de inhoud van een stijltabel in een andere stijltabel. |
key | Declareer een genaamd sleutel. |
message | Schrijf een bericht naar de uitvoer (voor foutmeldingen). |
namespace-alias | Vervang de namespaces in de stijltafel door verschillende namespaces in de uitvoer. |
number | Bepaal de integerpositie van de huidige knoop en formateer de cijfers. |
otherwise | Stel de standaardactie van het <choose> element in. |
output | Definieer het formaat van de uitvoerdocument. |
param | Declareer een lokale of globale parameter. |
preserve-space | Gebruikt om elementen te definiëren die witruimte moeten behouden. |
processing-instruction | Genereer een procesinstructieknopen. |
sort | Sorteer de resultaten. |
strip-space | Definieer de elementen die witruimte moeten verwijderen. |
stylesheet | Definieer de root-elemnt van de stylesheet. |
template | De regels die worden toegepast wanneer de opgegeven node wordt gescoord. |
text | Genereer tekstnodes door middel van de stylesheet. |
transform | Definieer de root-elemnt van de stylesheet. |
value-of | Haal de waarde van de geselecteerde nodes op. |
variable | Verklare lokale of globale variabelen. |
when | Specificeer de actie van het <choose> element. |
with-param | Specificeer de waarde van de parameter die moet worden ingevoerd in een sjabloon. |
XSLT, XPath en XQuery functies
- Acces
- Fout en trace
- Numeriek
- String
- AnyURI
- Logisch
- Duur/Datum/Tijd
- QName
- Node
- Reeks
- Context
- Ingebouwde functies
Accesfuncties
Name | Description |
---|---|
fn:node-name(node) | Geef de naam van het parameter node terug. |
fn:nilled(node) | Geef een boolean waarde terug die aangeeft of het parameter node weigert. |
fn:data(item.item,...) | Accepteert een reeks items en keert een reeks atomaire waarden terug. |
|
Geef de waarde van de base-uri eigenschap van de huidige of opgegeven node terug. |
fn:document-uri(node) | Geef de waarde van de document-uri eigenschap van de opgegeven node terug. |
Fout- en trace-functies
Name | Description |
---|---|
|
Voorbeeld: error(fn:QName('http://example.com/test', 'err:toohigh'), 'Error: Price is too high') Resultaat: Keer http://example.com/test#toohigh terug naar het externe verwerkingsmilieu en de string "Error: Price is too high". |
fn:trace(value,label) | Gebruikt voor debuggen van queries. |
Functies voor numerieke waarden
Name | Description |
---|---|
fn:number(arg) |
Geef de numerieke waarde van het parameter. Het parameter kan een boolean, string of node-set zijn. Voorbeeld: number('100') Resultaat: 100 |
fn:abs(num) |
Geef de absolute waarde van het parameter. Voorbeeld: abs(3.14) Resultaat: 3.14 Voorbeeld: abs(-3.14) Resultaat: 3.14 |
fn:ceiling(num) |
Geef het kleinste gehele getal dat groter is dan het parameter getal num. Voorbeeld: ceiling(3.14) 结果:4 |
fn:floor(num) |
Returns the largest integer that is not greater than the num parameter. Example: floor(3.14) Result: 3 |
fn:round(num) |
Rounds the num parameter to the nearest integer. Example: round(3.14) Result: 3 |
fn:round-half-to-even() |
Example: round-half-to-even(0.5) 结果:0 Example: round-half-to-even(1.5) Result: 2 Example: round-half-to-even(2.5) Result: 2 |
String functions
Name | Description |
---|---|
fn:string(arg) |
Returns the string value of the argument. The argument can be a number, a logical value, or a node set. Example: string(314) Result: "314" |
fn:codepoints-to-string(int,int,...) |
Returns a string from a sequence of code points. Example: codepoints-to-string(84, 104, 233, 114, 232, 115, 101) Result: 'Thérèse' |
fn:string-to-codepoints(string) |
Returns a sequence of code points from a string. Example: string-to-codepoints("Thérèse") Result: 84, 104, 233, 114, 232, 115, 101 |
fn:codepoint-equal(comp1,comp2) | According to the Unicode code point collation, if the value of comp1 is equal to the value of comp2, returns true. Otherwise, returns false. (http://www.w3.org/2005/02/xpath-functions/collation/codepoint) |
|
If comp1 is less than comp2, returns -1. If comp1 is equal to comp2, returns 0. If comp1 is greater than comp2, returns 1. (According to the used collation rules). Example: compare('ghi', 'ghi') 结果:0 |
fn:concat(string,string,...) |
Returns the concatenation of strings. Example: concat('XPath ','is ','FUN!') Result: 'XPath is FUN!' |
fn:string-join((string,string,...),sep) |
Uses the sep parameter as a separator to return the concatenated string of the string parameter. Example: string-join(('We', 'are', 'having', 'fun!'), ' ') Result: ' We are having fun! ' Example: string-join(('We', 'are', 'having', 'fun!')) Result: 'Wearehavingfun!' Example: string-join((), 'sep') Result: '' |
|
Returns a substring of the specified length starting from the start position. The index of the first character is 1. If the len parameter is omitted, it returns the substring from position start to the end of the string. Example: substring('Beatles',1,4) Result: 'Beat' Example: substring('Beatles',2) Result: 'eatles' |
|
Returns the length of the specified string. If no string parameter is provided, it returns the length of the string value of the current node. Example: string-length('Beatles') Result: 7 |
|
Removes the leading and trailing whitespace of the specified string, replaces all internal whitespace sequences with one, and then returns the result. If no string parameter is provided, it processes the current node. Example: normalize-space(' The XML ') Result: 'The XML' |
fn:normalize-unicode() | Executes Unicode normalization. |
fn:upper-case(string) |
Converts the string parameter to uppercase. Example: upper-case('The XML') Result: 'THE XML' |
fn:lower-case(string) |
Converts the string parameter to lowercase. Example: lower-case('The XML') Result: 'the xml' |
fn:translate(string1,string2,string3) |
Vervang string2 in string1 door string3. Voorbeeld: translate('12:30','30','45') Resultaat: '12:45' Voorbeeld: translate('12:30','03','54') Resultaat: '12:45' Voorbeeld: translate('12:30','0123','abcd') Resultaat: 'bc:da' |
fn:escape-uri(stringURI,esc-res) |
Voorbeeld: escape-uri("http://example.com/test#car", true()) Resultaat: "http%3A%2F%2Fexample.com%2Ftest#car" Voorbeeld: escape-uri("http://example.com/test#car", false()) Resultaat: "http://example.com/test#car" Voorbeeld: escape-uri ("http://example.com/~bébé", false()) Resultaat: "http://example.com/~b%C3%A9b%C3%A9" |
fn:contains(string1,string2) |
Retourneer true als string1 bevat string2, anders retourneer false. Voorbeeld: contains('XML','XM') Resultaat: true |
fn:starts-with(string1,string2) |
Retourneer true als string1 begint met string2, anders retourneer false. Voorbeeld: starts-with('XML','X') Resultaat: true |
fn:ends-with(string1,string2) |
Retourneer true als string1 eindigt op string2, anders retourneer false. Voorbeeld: ends-with('XML','X') Resultaat: false |
fn:substring-before(string1,string2) |
Geef het ondersteunde deel van de string2 voor het verschijnen van string1. Voorbeeld: substring-before('12/10','/') Resultaat: '12' |
fn:substring-after(string1,string2) |
Geef het ondersteunde deel van de string2 na het verschijnen van string1. Voorbeeld: substring-after('12/10','/') Resultaat: '10' |
fn:matches(string,pattern) |
Retourneer true als de string parameter overeenkomt met het opgegeven patroon, anders retourneer false. Voorbeeld: matches("Merano", "ran") Resultaat: true |
fn:replace(string,pattern,replace) |
Vervang de opgegeven patroon door de replace parameter en retourneer het resultaat. Voorbeeld: replace("Bella Italia", "l", "*") Resultaat: 'Be**a Ita*ia' Voorbeeld: replace("Bella Italia", "l", "") Resultaat: 'Bea Itaia' |
fn:tokenize(string,pattern) |
Voorbeeld: tokenize("XPath is fun", "\s+") Resultaat: ("XPath", "is", "fun") |
Functies voor anyURI.
Name | Description |
---|---|
fn:resolve-uri(relative,base) |
Functies over booleaanse waarden.
Name | Description |
---|---|
fn:boolean(arg) | Retourneer de booleaanse waarde van een getal, string of node-set. |
fn:not(arg) |
Eerst herstel de parameter naar een booleaanse waarde met de boolean() functie. Retourneer true als de booleaanse waarde false is, anders retourneer true. Voorbeeld: not(true()) Resultaat: false |
fn:true() |
Teruggeef de booleaanse waarde true. Voorbeeld: true() Resultaat: true |
fn:false() |
Teruggeef de booleaanse waarde false. Voorbeeld: false() Resultaat: false |
Functies voor duur, datum en tijd.
Functies voor het extraheren van componenten van datum, tijd en duur.
Name | Description |
---|---|
fn:dateTime(date,time) | Converteer de parameter naar een datum en tijd. |
fn:years-from-duration(datetimedur) | Teruggeef het gehele getal van het jaaredeel van het argument, weergegeven in standaard woordenschat. |
fn:months-from-duration(datetimedur) | Teruggeef het gehele getal van het maanddeel van het argument, weergegeven in standaard woordenschat. |
fn:days-from-duration(datetimedur) | Teruggeef het gehele getal van het dagdeel van het argument, weergegeven in standaard woordenschat. |
fn:hours-from-duration(datetimedur) | Retourneert het gehele getal dat het uren deel van de parameter vertegenwoordigt, weergegeven in standaard woordenschat. |
fn:minutes-from-duration(datetimedur) | Retourneert het gehele getal dat het minuten deel van de parameter vertegenwoordigt, weergegeven in standaard woordenschat. |
fn:seconds-from-duration(datetimedur) | Retourneert het decimale getal dat het minuten deel van de parameter vertegenwoordigt, weergegeven in standaard woordenschat. |
fn:year-from-dateTime(datetime) |
Retourneert het gehele getal dat het jaren deel van de parameter vertegenwoordigt. Voorbeeld: year-from-dateTime(xs:dateTime("2005-01-10T12:30-04:10")) 结果:2005 |
fn:month-from-dateTime(datetime) |
Retourneert het gehele getal dat het maanden deel van de parameter vertegenwoordigt. Voorbeeld: month-from-dateTime(xs:dateTime("2005-01-10T12:30-04:10")) Resultaat: 01 |
fn:day-from-dateTime(datetime) |
Retourneert het gehele getal dat het dagen deel van de parameter vertegenwoordigt. Voorbeeld: day-from-dateTime(xs:dateTime("2005-01-10T12:30-04:10")) 结果:10 |
fn:hours-from-dateTime(datetime) |
Retourneert het gehele getal dat het uren deel van de parameter vertegenwoordigt. Voorbeeld: hours-from-dateTime(xs:dateTime("2005-01-10T12:30-04:10")) Resultaat: 12 |
fn:minutes-from-dateTime(datetime) |
Retourneert het gehele getal dat het minuten deel van de parameter vertegenwoordigt. Voorbeeld: minutes-from-dateTime(xs:dateTime("2005-01-10T12:30-04:10")) Resultaat: 30 |
fn:seconds-from-dateTime(datetime) |
Retourneert het decimale getal dat het seconden deel van de parameter vertegenwoordigt. Voorbeeld: seconds-from-dateTime(xs:dateTime("2005-01-10T12:30:00-04:10")) 结果:0 |
fn:timezone-from-dateTime(datetime) | 返回参数的时区部分,如果存在。 |
fn:year-from-date(date) |
Retourneert het lokale getal dat de parameter vertegenwoordigt voor het jaar. Voorbeeld: year-from-date(xs:date("2005-04-23")) 结果:2005 |
fn:month-from-date(date) |
返回参数本地值中表示月的整数。 例子:month-from-date(xs:date("2005-04-23")) 结果:4 |
fn:day-from-date(date) |
返回参数本地值中表示天的整数。 例子:day-from-date(xs:date("2005-04-23")) 结果:23 |
fn:timezone-from-date(date) | 返回参数的时区部分,如果存在。 |
fn:hours-from-time(time) |
返回参数本地值中表示小时部分的整数。 例子:hours-from-time(xs:time("10:22:00")) 结果:10 |
fn:minutes-from-time(time) |
返回参数本地值中表示分钟部分的整数。 例子:minutes-from-time(xs:time("10:22:00")) 结果:22 |
fn:seconds-from-time(time) |
返回参数本地值中表示秒部分的整数。 例子:seconds-from-time(xs:time("10:22:00")) 结果:0 |
fn:timezone-from-time(time) | 返回参数的时区部分,如果存在。 |
fn:adjust-dateTime-to-timezone(datetime,timezone) |
如果 timezone 参数为空,则返回没有时区的 dateTime。 否则返回带有时区的 dateTime。 |
fn:adjust-date-to-timezone(date,timezone) |
如果 timezone 参数为空,则返回没有时区的 date。 否则返回带有时区的 date。 |
fn:adjust-time-to-timezone(time,timezone) |
如果 timezone 参数为空,则返回没有时区的 time。 否则返回带有时区的 time。 |
与 QNames 相关的函数
Name | Description |
---|---|
fn:QName() | |
fn:local-name-from-QName() | |
fn:namespace-uri-from-QName() | |
fn:namespace-uri-for-prefix() | |
fn:in-scope-prefixes() | |
fn:resolve-QName() |
Functies over knooppunten
Name | Description |
---|---|
|
Retourneert de naam van het huidige knooppunt of de eerste knooppunt in de opgegeven knooppuntcollectie. |
|
Retourneert de naam van het huidige knooppunt of de eerste knooppunt in de opgegeven knooppuntcollectie zonder namespace voorvoegsel. |
|
Retourneert de namespace URI van de huidige knooppunt of de eerste knooppunt in de opgegeven knooppuntcollectie. |
fn:lang(lang) |
Retourneert true als de taal van het huidige knooppunt overeenkomt met de opgegeven taal. Voorbeeld: Lang("en") is true voor <p xml:lang="en">...</p> Voorbeeld: Lang("de") is false voor <p xml:lang="en">...</p> |
|
Retourneert de wortel van het knooppuntboom van de huidige knooppunt of het opgegeven knooppunt. Dit is meestal de documentknooppunt. |
Functies voor reeksen
Algemene functie
Name | Description |
---|---|
fn:index-of((item,item,...),searchitem) |
Retourneert de positie van het item in de reeks die gelijk is aan de searchitem parameter. Voorbeeld: index-of ((15, 40, 25, 40, 10), 40) Resultaat: (2, 4) Voorbeeld: index-of (("a", "dog", "and", "a", "duck"), "a") Resultaat (1, 4) Voorbeeld: index-of ((15, 40, 25, 40, 10), 18) Resultaat: () |
fn:remove((item,item,...),position) |
Retourneert een nieuwe reeks gevormd door de item parameter, terwijl het item op de opgegeven positie wordt verwijderd. Voorbeeld: remove(("ab", "cd", "ef"), 0) Resultaat: ("ab", "cd", "ef") Voorbeeld: remove(("ab", "cd", "ef"), 1) Resultaat: ("cd", "ef") Voorbeeld: remove(("ab", "cd", "ef"), 4) Resultaat: ("ab", "cd", "ef") |
fn:empty(item,item,...) |
Retourneert true als de parameterwaarde een lege reeks is, anders retourneert het false. Voorbeeld: empty(remove(("ab", "cd"), 1)) Resultaat: false |
fn:exists(item,item,...) |
Retourneert true als de parameterwaarde niet een lege reeks is, anders retourneert het false. Voorbeeld: exists(remove(("ab"), 1)) Resultaat: false |
fn:distinct-values((item,item,...),collation) |
Retourneert unieke waarden. Voorbeeld: distinct-values((1, 2, 3, 1, 2)) Resultaat: (1, 2, 3) |
fn:insert-before((item,item,...),pos,inserts) |
Retourneert een nieuwe reeks die is gecreëerd door het item parameter, waarbij de waarde van de inserts parameter wordt ingevoegd op de positie gespecificeerd door het pos parameter. Voorbeeld: insert-before(("ab", "cd"), 0, "gh") Resultaat: ("gh", "ab", "cd") Voorbeeld: insert-before(("ab", "cd"), 1, "gh") Resultaat: ("gh", "ab", "cd") Voorbeeld: insert-before(("ab", "cd"), 2, "gh") Resultaat: ("ab", "gh", "cd") Voorbeeld: insert-before(("ab", "cd"), 5, "gh") Resultaat: ("ab", "cd", "gh") |
fn:reverse((item,item,...)) |
Retourneert de omgekeerde volgorde van de gespecificeerde items. Voorbeeld: reverse(("ab", "cd", "ef")) Resultaat: ("ef", "cd", "ab") Voorbeeld: reverse(("ab")) Resultaat: ("ab") |
fn:subsequence((item,item,...),start,len) |
Retourneert een itemreeks die wordt gespecificeerd door de start parameter, met een lengte die wordt gespecificeerd door de len parameter. De positie van het eerste item is 1. Voorbeeld: subsequence(($item1, $item2, $item3,...), 3) Resultaat: ($item3, ...) Voorbeeld: subsequence(($item1, $item2, $item3, ...), 2, 2) Resultaat: ($item2, $item3) |
fn:unordered((item,item,...)) | Retourneert de items in de volgorde die door de implementatie wordt bepaald. |
Testfunctie voor de capaciteit van de reeks
Name | Description |
---|---|
fn:zero-or-one(item,item,...) | If the parameter contains zero or one item, return the parameter, otherwise generate an error. |
fn:one-or-more(item,item,...) | If the parameter contains one or more items, return the parameter, otherwise generate an error. |
fn:exactly-one(item,item,...) | If the parameter contains an item, return the parameter, otherwise generate an error. |
Equals, Union, Intersection and Except
Name | Description |
---|---|
fn:deep-equal(param1,param2,collation) | Returns true if param1 and param2 are equal to each other (deep-equal), otherwise returns false. |
Aggregate Functions
Name | Description |
---|---|
fn:count((item,item,...)) | Returns the number of nodes. |
fn:avg((arg,arg,...)) |
Returns the average value of the parameter values. Example: avg((1,2,3)) Result: 2 |
fn:max((arg,arg,...)) |
Returns the parameter that is greater than the other parameters. Example: max((1,2,3)) Result: 3 Example: max(('a', 'k')) Result: 'k' |
fn:min((arg,arg,...)) |
Returns the parameter that is less than the other parameters. Example: min((1,2,3)) Result: 1 Example: min(('a', 'k')) Result: 'a' |
fn:sum(arg,arg,...) | Returns the sum of the numerical values of each node in the specified node set. |
Functions that generate sequences
Name | Description |
---|---|
fn:id((string,string,...),node) | Returns a sequence of element nodes whose ID values equal one or more values specified in the string parameter. |
fn:idref((string,string,...),node) | Returns a sequence of element or attribute nodes whose IDREF values equal one or more values specified in the string parameter. |
fn:doc(URI) | |
fn:doc-available(URI) | Returns true if the doc() function returns a document node, otherwise returns false. |
|
Context Functions
Name | Description |
---|---|
fn:position() |
Returns the index position of the current node being processed. Example: //book[position()<=3] Result: Select the first three book elements |
fn:last() |
Return the number of items in the list of nodes being processed. Example: //book[last()] Result: Select the last book element |
fn:current-dateTime() | Return the current dateTime (with timezone). |
fn:current-date() | Return the current date (with timezone). |
fn:current-time() | Return the current time (with timezone). |
fn:implicit-timezone() | Return the value of the implicit timezone. |
fn:default-collation() | Return the value of the default collation. |
fn:static-base-uri() | Return the value of base-uri. |
XSLT Functions
In addition, the following built-in XSLT functions are available:
Name | Description |
---|---|
current() | Return a node set that contains the current node as its only member. |
document() | Used to access nodes in an external XML document. |
element-available() | Check if the XSLT processor supports the specified element. |
format-number() | Convert a number to a string. |
function-available() | Check if the XSLT processor supports the specified function. |
generate-id() | Return a string value that uniquely identifies the specified node. |
key() | Retrieve elements previously marked with the <xsl:key> statement. |
node-set | Convert the tree to a node set. The resulting node set always contains a single node and is the root of the tree. |
system-property() | Return the value of the system property. |
unparsed-entity-uri() | Return the URI of the unparsed entity. |
Other XML DOM objects
- DOM CharacterData
- DOM CSS2Properties
- DOM CSSRule
- DOM CSSStyleRule
- DOM CSSStyleSheet
- DOM DocumentType
- DOM DOMException
- DOM Implementation
- DOM DOMParser
- DOM Event
- DOM HTMLCollection
- DOM HTMLDocument
- DOM HTMLElement
- DOM ProcessingInstr
- DOM Range
- DOM RangeException
- DOM XMLSerializer
- DOM XPathExpression
- DOM XPathResult
- DOM XSLTProcessor
- Vorige pagina XSD variabelen
- Volgende pagina DOM knooppunttypen