This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
From http://www.w3.org/TR/xslt-30/ | |
A standard grouping exercise to wrap a group of elements | |
--> | |
<xsl:template match="body"> | |
<chapter> | |
<xsl:for-each-group select="*" group-starting-with="h2"> | |
<section title="{self::h2}"> | |
<xsl:for-each select="current-group()[self::p]"> | |
<para><xsl:value-of select="."/></para> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach f ('NSGlobalDomain' `defaults domains`) | |
d=`echo $f | sed 's/,$//'` | |
defaults export $d $d.plist && plutil -convert xml1 $d.plist | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet | |
version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:ext="http://example.com/extensions" | |
extension-element-prefixes="ext" | |
exclude-result-prefixes="xs"> | |
<xsl:template match="/"> | |
<xsl:variable name="test" as="document-node(element(foo))?"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
exclude-result-prefixes="xs" | |
version="2.0"> | |
<xsl:template name="main"> | |
<xsl:sequence select="doc-available('empty.xml')"/> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet | |
version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
exclude-result-prefixes="xs"> | |
<xsl:template match="foo"> | |
<bar/> | |
</xsl:template> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
$isNegative := function($x as xs:integer) {$x lt 0}, | |
$decrement := function($x as xs:integer) {$x - 1}, | |
$until.r := | |
function( | |
$p as function(item()*) as xs:boolean, | |
$f as function(item()*) as item()*, | |
$x as item()*, | |
$r as function(function(), function(), item()*, function()) as item()*) as item()* { | |
if ($p($x)) then $x else $helper($p, $f, $f($x), $r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function($input as xs:string) as xs:string { | |
fold-left( | |
function($s,$r){ | |
replace($s,upper-case($r)||$r,$r) | |
}, | |
$input, | |
((1 to 26) ! format-integer(.,'a'))) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet | |
version="3.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:file="java:java.io.File" | |
xmlns:jt="http://saxon.sf.net/java-type" | |
exclude-result-prefixes="xs file jt"> | |
<xsl:param name="directory"/> | |