Show Menu
Cheatography

XML Cheat Sheet (DRAFT) by

Xpath/Xquery/XSD/XSLT

This is a draft cheat sheet. It is a work in progress and is not finished yet.

XSD

Atributs:
Default
Fixed
From
Id
Name
Ref
Type
Use
Types:
String
Decimal
Integer
Boolean
Date
Time
Repetició:
Sequence
Choice
All
 

XSLT

<template> ---> Sortida

Att:Match de Template---> Arrel

<xsl:for-each select=" ">

<xsl:value-of select=" "/>

(for)Att: order-by="+-"   OR---> <xsl:sort select=""/>

<xsl:if test="expression"> --> (After for )
 

Xpath

Selecció nodes
/
De arrel
//
Arrel (no cal direccio)
.
Actual
..
Pare del actual
@
Atribut
Funcions:
last()
posicio Ultim node
position()
posicio node
count(­nod­e-set)
nombre de nodes
number sum(no­de-set)
retorna la suma
number round 8number)
Predicats:
/books­tor­e/b­ook[1]
el numero indica
/books­tor­e/b­ook­[la­st()]
ultim
/books­tor­e/b­ook­[la­st()-1]
penultim
/books­tor­e/b­ook­[po­sit­ion­()<3]
tots menys de 3
//titl­e[@­lang]
tots atribut lang
/books­tor­e/b­ook­[pr­ice­>35.00­]/title
titol de llibre amb condicio
 

Xquery

Variables
let $resultat := "Hola món!"
return $resultat

DOC:

let $d := doc('/Users/palamos/Google Drive/M4-
XML/UF2/material/xquery_intro/videos.xml')
return $d

FOR:

for $a in $doc//actors/actor

WHERE:

where ends-with($a,	'Lisa')