backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / docs / wrapstring.xsl
blobb468a700f5e2f79333813d545be2ba87b46c9de8
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <!-- based on http://plasmasturm.org/log/xslwordwrap/ -->
5 <!-- Copyright 2010 Aristotle Pagaltzis; under the MIT licence -->
6 <!-- http://www.opensource.org/licenses/mit-license.php -->
7 <xsl:template name="wrap-string">
8 <xsl:param name="str" />
9 <xsl:param name="wrap-col" />
10 <xsl:param name="break-mark" />
11 <xsl:param name="pos" select="0" />
12 <xsl:choose>
13 <xsl:when test="contains( $str, ' ' )">
14 <xsl:variable name="first-word" select="substring-before( $str, ' ' )" />
15 <xsl:variable name="pos-now" select="$pos + 1 + string-length( $first-word )" />
16 <xsl:choose>
17 <xsl:when test="$pos > 0 and $pos-now >= $wrap-col">
18 <xsl:copy-of select="$break-mark" />
19 <xsl:call-template name="wrap-string">
20 <xsl:with-param name="str" select="$str" />
21 <xsl:with-param name="wrap-col" select="$wrap-col" />
22 <xsl:with-param name="break-mark" select="$break-mark" />
23 <xsl:with-param name="pos" select="0" />
24 </xsl:call-template>
25 </xsl:when>
26 <xsl:otherwise>
27 <xsl:if test="$pos > 0">
28 <xsl:text> </xsl:text>
29 </xsl:if>
30 <xsl:value-of select="$first-word" />
31 <xsl:call-template name="wrap-string">
32 <xsl:with-param name="str" select="substring-after( $str, ' ' )" />
33 <xsl:with-param name="wrap-col" select="$wrap-col" />
34 <xsl:with-param name="break-mark" select="$break-mark" />
35 <xsl:with-param name="pos" select="$pos-now" />
36 </xsl:call-template>
37 </xsl:otherwise>
38 </xsl:choose>
39 </xsl:when>
40 <xsl:otherwise>
41 <xsl:choose>
42 <xsl:when test="$pos + string-length( $str ) >= $wrap-col">
43 <xsl:copy-of select="$break-mark" />
44 </xsl:when>
45 <xsl:otherwise>
46 <xsl:if test="$pos > 0">
47 <xsl:text> </xsl:text>
48 </xsl:if>
49 </xsl:otherwise>
50 </xsl:choose>
51 <xsl:value-of select="$str" />
52 </xsl:otherwise>
53 </xsl:choose>
54 </xsl:template>
56 </xsl:stylesheet>