revegen ramp up. here we go!
This commit is contained in:
133
legacy-resumes/resume-1/xsl/lib/address.xsl
Normal file
133
legacy-resumes/resume-1/xsl/lib/address.xsl
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
address.xsl
|
||||
Defines some common templates for address processing that are
|
||||
shared by all the stylesheets.
|
||||
|
||||
Copyright (c) 2000-2001 Sean Kelly, Bruce Christensen
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$Id: address.xsl,v 1.1 2002/05/26 03:45:51 bruckie Exp $
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:r="http://xmlresume.sourceforge.net/resume/0.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<!-- It would be nice if XSLT allowed variable reference in mode -->
|
||||
<!-- selection; then instead of the ugly template below, we'd have -->
|
||||
<!-- '<xsl:apply-templates select="r:address" mode="$address.format"/>'-->
|
||||
<!-- But it doesn't, so we need this. -->
|
||||
<xsl:template match="r:address">
|
||||
|
||||
<!-- Determine formatting method from format attr of this element if -->
|
||||
<!-- it exists, otherwise use $address.format parameter. -->
|
||||
<xsl:variable name="format">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@format">
|
||||
<xsl:value-of select="@format"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$address.format"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<!-- If the first child is a text node, assume that we -->
|
||||
<!-- have a preformatted address and bypass the address -->
|
||||
<!-- formatting below. -->
|
||||
<xsl:when test="node()[1][not(self::*)]">
|
||||
<xsl:apply-templates select="." mode="free-form"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$format = 'standard'">
|
||||
<xsl:apply-templates select="." mode="standard"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$format = 'european'">
|
||||
<xsl:apply-templates select="." mode="european"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$format = 'italian'">
|
||||
<xsl:apply-templates select="." mode="italian"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- template to determine the AdminDivision for use in addresses. -->
|
||||
<!-- AdminDivision is a pseudo-field for the principal administrative -->
|
||||
<!-- division of the country: state in the US, province in Canada, -->
|
||||
<!-- county in Ireland, for example. -->
|
||||
<xsl:template name="AdminDivision">
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="r:state">
|
||||
<xsl:value-of select="normalize-space(r:state)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="r:province">
|
||||
<xsl:value-of select="normalize-space(r:province)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="r:county">
|
||||
<xsl:value-of select="normalize-space(r:county)"/>
|
||||
</xsl:when>
|
||||
<!-- Otherwise, leave blank -->
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- template to determine the CityDivision for use in addresses. -->
|
||||
<!-- "Suburb" is used in New Zealand; "Ward" in Brazil and Japan. -->
|
||||
<xsl:template name="CityDivision">
|
||||
<xsl:choose>
|
||||
<xsl:when test="r:suburb">
|
||||
<xsl:value-of select="normalize-space(r:suburb)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="r:ward">
|
||||
<xsl:value-of select="normalize-space(r:ward)"/>
|
||||
</xsl:when>
|
||||
<!-- Otherwise, leave blank -->
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- template to determine the code to be used in addresses. -->
|
||||
<xsl:template name="PostCode">
|
||||
<xsl:choose>
|
||||
<xsl:when test="r:zip">
|
||||
<xsl:value-of select="normalize-space(r:zip)"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="r:postalCode">
|
||||
<xsl:value-of select="normalize-space(r:postalCode)"/>
|
||||
</xsl:when>
|
||||
<!-- Otherwise, leave blank -->
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
317
legacy-resumes/resume-1/xsl/lib/common.xsl
Normal file
317
legacy-resumes/resume-1/xsl/lib/common.xsl
Normal file
@@ -0,0 +1,317 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
common.xsl
|
||||
Defines some common templates shared by all the stylesheets.
|
||||
|
||||
Copyright (c) 2002 Sean Kelley and contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$Id: common.xsl,v 1.8 2002/11/05 08:51:53 brandondoyle Exp $
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:r="http://xmlresume.sourceforge.net/resume/0.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<!-- Since string.xsl is <xsl:include>ed by {html,fo,text}.xsl, we import it
|
||||
here to avoid defining it twice. -->
|
||||
<xsl:import href="string.xsl"/>
|
||||
|
||||
<xsl:include href="deprecated.xsl"/>
|
||||
<xsl:include href="address.xsl"/>
|
||||
<xsl:include href="pub.xsl"/>
|
||||
|
||||
<!-- Outputs the text to use as a title. -->
|
||||
<!-- Uses <title> child element if present, otherwise $Default. -->
|
||||
<xsl:template name="Title">
|
||||
<xsl:param name="Title">NO DEFAULT TITLE DEFINED</xsl:param>
|
||||
<xsl:param name="Separator"></xsl:param>
|
||||
<xsl:choose>
|
||||
<xsl:when test="r:title">
|
||||
<xsl:value-of select="normalize-space(r:title)"/>
|
||||
<xsl:value-of select="$Separator"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$Title"/>
|
||||
<xsl:value-of select="$Separator"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="r:title">
|
||||
<xsl:param name="Separator"></xsl:param>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:value-of select="$Separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- CONTACTS =========================================================== -->
|
||||
<xsl:template name="PhoneLocation">
|
||||
<xsl:param name="Location"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$Location = 'home'">
|
||||
<xsl:value-of select="$phone.home.phrase"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Location = 'work'">
|
||||
<xsl:value-of select="$phone.work.phrase"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Location = 'mobile'">
|
||||
<xsl:value-of select="$phone.mobile.phrase"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length($Location) > 0">
|
||||
<xsl:message>
|
||||
<xsl:text>***** WARNING: Unknown phone location: '</xsl:text>
|
||||
<xsl:value-of select="$Location"/>
|
||||
<xsl:text>' (inserting literally into output)</xsl:text>
|
||||
</xsl:message>
|
||||
<xsl:value-of select="$Location"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$phone.word"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="FaxLocation">
|
||||
<xsl:param name="Location"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$Location = 'home'">
|
||||
<xsl:value-of select="$fax.home.phrase"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Location = 'work'">
|
||||
<xsl:value-of select="$fax.work.phrase"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length($Location) > 0">
|
||||
<xsl:message>
|
||||
<xsl:text>***** WARNING: Unknown fax location: '</xsl:text>
|
||||
<xsl:value-of select="$Location"/>
|
||||
<xsl:text>' (inserting literally into output)</xsl:text>
|
||||
</xsl:message>
|
||||
<xsl:value-of select="$Location"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$fax.word"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="IMServiceName">
|
||||
<xsl:param name="Service"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$Service = 'aim'">
|
||||
<xsl:value-of select="$im.aim.service"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Service = 'icq'">
|
||||
<xsl:value-of select="$im.icq.service"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Service = 'irc'">
|
||||
<xsl:value-of select="$im.irc.service"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Service = 'jabber'">
|
||||
<xsl:value-of select="$im.jabber.service"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Service = 'msn'">
|
||||
<xsl:value-of select="$im.msn.service"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$Service = 'yahoo'">
|
||||
<xsl:value-of select="$im.yahoo.service"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="string-length($Service) > 0">
|
||||
<xsl:message>
|
||||
<xsl:text>***** WARNING: Unknown instantMessage service: '</xsl:text>
|
||||
<xsl:value-of select="$Service"/>
|
||||
<xsl:text>' (inserting literally into output)</xsl:text>
|
||||
</xsl:message>
|
||||
<xsl:value-of select="$Service"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- HEADER ============================================================= -->
|
||||
<!-- Call header template in appropriate mode -->
|
||||
<xsl:template match="r:header">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$header.format = 'centered'">
|
||||
<xsl:apply-templates select="." mode="centered"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="." mode="standard"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- DEGREE ============================================================= -->
|
||||
<!-- Format a major -->
|
||||
<xsl:template match="r:major">
|
||||
<xsl:apply-templates/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(following-sibling::r:major) > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="count(following-sibling::r:major) = 1">
|
||||
<xsl:if test="count(preceding-sibling::r:major) > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$and.word"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format a minor -->
|
||||
<xsl:template match="r:minor">
|
||||
<xsl:if test="position() = 1">
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(following-sibling::r:minor) > 0">
|
||||
<xsl:text> (</xsl:text>
|
||||
<xsl:value-of select="$minors.word"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text> (</xsl:text>
|
||||
<xsl:value-of select="$minor.word"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$in.word"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:apply-templates/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(following-sibling::r:minor) > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="count(following-sibling::r:minor) = 1">
|
||||
<xsl:if test="count(preceding-sibling::r:minor) > 1">
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$and.word"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="count(following-sibling::r:minor) = 0">
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- SKILLS ============================================================= -->
|
||||
<!-- Normalize space in skills, but preserve descendant elements. This
|
||||
replaced the following code in the r:skill template:
|
||||
|
||||
<xsl:variable name="Text">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="normalize-space($Text)"/>
|
||||
|
||||
The problem with the above code is that if a skill contains other elements
|
||||
(for example, a <link>), the normalize-space call removes those elements. This
|
||||
solution avoids that problem.
|
||||
-->
|
||||
<xsl:template match="r:skill//text()">
|
||||
<xsl:value-of select="normalize-space(.)"/>
|
||||
|
||||
<!-- This part's a bit complicated. It basically says to output a space IF:
|
||||
1. This text node is followed by an element or another text node.
|
||||
2. AND This element has trailing whitespace.
|
||||
We can't ignore the second requirement, or else we format input like this:
|
||||
"<skill>Apache (<url>www.apache.org</url>)</skill>"
|
||||
As:
|
||||
"Apache ( www.apache.org)"
|
||||
Our more complicated rule yields the correct output:
|
||||
"Apache (www.apache.org)"
|
||||
-->
|
||||
<xsl:if test="following-sibling::* or following-sibling::text()">
|
||||
|
||||
<xsl:variable name="TrailingWS">
|
||||
<xsl:call-template name="TrailingSpace">
|
||||
<xsl:with-param name="Text">
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:if test="string-length($TrailingWS)">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- LOCATION =========================================================== -->
|
||||
<!-- Location sub-elements -->
|
||||
<xsl:template match="r:location/*">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:if test="following-sibling::*">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- NAMES ============================================================== -->
|
||||
<!-- Format a name in Western style, given then surname -->
|
||||
<!-- (plus title, middle and suffix if defined). -->
|
||||
<xsl:template match="r:name">
|
||||
<xsl:if test="r:title">
|
||||
<xsl:apply-templates select="r:title"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="r:firstname"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="r:middlenames">
|
||||
<xsl:apply-templates select="r:middlenames"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="r:surname"/>
|
||||
<xsl:if test="r:suffix">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="r:suffix"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Call subjects template in appropriate mode -->
|
||||
<xsl:template match="r:subjects">
|
||||
<xsl:if test="r:subject">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$subjects.format = 'table'">
|
||||
<xsl:apply-templates select="." mode="table"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates select="." mode="comma"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
137
legacy-resumes/resume-1/xsl/lib/deprecated.xsl
Normal file
137
legacy-resumes/resume-1/xsl/lib/deprecated.xsl
Normal file
@@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
deprecated.xsl
|
||||
Print warning messages about deprecated elements.
|
||||
|
||||
Copyright (c) 2000-2002 by Bruce Christensen
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$Id: deprecated.xsl,v 1.1 2002/05/26 03:45:51 bruckie Exp $
|
||||
-->
|
||||
|
||||
<!--
|
||||
In general, each block is responsible for outputting a newline after itself.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:r="http://xmlresume.sourceforge.net/resume/0.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<!-- Deprecated in 1.3.3 -->
|
||||
<xsl:template match="r:break">
|
||||
<xsl:message>
|
||||
WARNING: break deprecated
|
||||
The break element is deprecated as of version 1.3.3 of the XML Resume
|
||||
Library. It will be removed in a future version. It is recommended that
|
||||
you remove all break elements.
|
||||
You can use "make 13x-140" to fix this problem.
|
||||
</xsl:message>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="r:company">
|
||||
<xsl:message>
|
||||
WARNING: company deprecated
|
||||
The company element is deprecated as of version 1.3.3 of the XML Resume
|
||||
Library. It will be removed in a future version. It is recommended that
|
||||
you remove all company elements.
|
||||
You can use "make 13x-140" to fix this problem.
|
||||
</xsl:message>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="r:street2">
|
||||
<xsl:message>
|
||||
WARNING: street2 deprecated
|
||||
The street2 element is deprecated as of version 1.3.3 of the XML Resume
|
||||
Library. It will be removed in a future version. It is recommended that
|
||||
you convert all street2 elements to street elements.
|
||||
You can use "make 13x-140" to fix this problem.
|
||||
</xsl:message>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Deprecated in 1.4.0 -->
|
||||
<xsl:template match="r:skillareas">
|
||||
<xsl:message>
|
||||
WARNING: skillareas deprecated
|
||||
The skillareas element is deprecated as of version 1.4.0 of the XML
|
||||
Resume Library. It will be removed in a future version. It is
|
||||
recommended that you remove all skillareas elements. skillarea elements
|
||||
may now be direct children of resume.
|
||||
You can use "make 13x-140" to fix this problem.
|
||||
</xsl:message>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="SkillsDeprecatedMessage">
|
||||
<xsl:message>
|
||||
WARNING: skills deprecated
|
||||
The skills element is deprecated as of version 1.4.0 of the XML Resume
|
||||
Library. It will be removed in a future version. It is recommended that
|
||||
you remove all skills elements. skill elements may now be direct
|
||||
children of skillset.
|
||||
You can use "make 13x-140" to fix this problem.
|
||||
</xsl:message>
|
||||
</xsl:template>
|
||||
<xsl:template match="r:skills">
|
||||
<xsl:call-template name="SkillsDeprecatedMessage"/>
|
||||
<xsl:apply-templates select="r:skill"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="r:skills" mode="comma">
|
||||
<xsl:call-template name="SkillsDeprecatedMessage"/>
|
||||
<xsl:apply-templates select="r:skill" mode="comma"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="r:skills" mode="bullet">
|
||||
<xsl:call-template name="SkillsDeprecatedMessage"/>
|
||||
<xsl:apply-templates select="r:skill" mode="bullet"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="r:pubDate">
|
||||
<xsl:message>
|
||||
WARNING: pubDate deprecated
|
||||
The pubDate element is deprecated as of version 1.4.0 of the XML Resume
|
||||
Library. It will be removed in a future version. It is recommended that
|
||||
you replace pubDate elements with date elements.
|
||||
You can use "make 13x-140" to fix this problem.
|
||||
</xsl:message>
|
||||
<xsl:call-template name="FormatPubDate"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="r:docpath | r:head | r:node | r:tail | r:label | r:uri">
|
||||
<xsl:message>
|
||||
WARNING: docpath, head, node, tail, label, and uri deprecated
|
||||
The docpath, head, node, tail, label, and uri elements are deprecated as
|
||||
of version 1.4.0 of the XML Resume Library. They will be removed in a
|
||||
future version. It is recommended that you remove all of these elements.
|
||||
You can use "make 13x-140" to fix this problem.
|
||||
</xsl:message>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
135
legacy-resumes/resume-1/xsl/lib/pub.xsl
Normal file
135
legacy-resumes/resume-1/xsl/lib/pub.xsl
Normal file
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
pub.xsl
|
||||
Transformations for publications.
|
||||
|
||||
Copyright (c) 2002 Sean Kelly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$Id: pub.xsl,v 1.1 2002/05/26 03:45:51 bruckie Exp $
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:r="http://xmlresume.sourceforge.net/resume/0.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:template name="FormatPub">
|
||||
<!-- Format each author, putting separator characters betwixt. -->
|
||||
<xsl:apply-templates select="r:author[position() != last()]" mode="internal"/>
|
||||
<xsl:apply-templates select="r:author[position() = last()]" mode="final"/>
|
||||
<!-- Format the other components of a publication. -->
|
||||
<xsl:apply-templates select="r:artTitle"/>
|
||||
<xsl:apply-templates select="r:bookTitle"/>
|
||||
<xsl:apply-templates select="r:publisher"/>
|
||||
<xsl:apply-templates select="r:date"/>
|
||||
<xsl:apply-templates select="r:pubDate"/> <!-- Deprecated as of 1.4.0. -->
|
||||
<xsl:apply-templates select="r:pageNums"/>
|
||||
<xsl:apply-templates select="r:url"/>
|
||||
<!-- And for those using free-form paragraphs, format those, too. -->
|
||||
<xsl:apply-templates select="r:para"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format the all but the last author -->
|
||||
<xsl:template match="r:author" mode="internal">
|
||||
<xsl:call-template name="DerefAuthor"/>
|
||||
<xsl:value-of select="$pub.author.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format the last author whose name doesn't end in a period.
|
||||
NOTE: This prevents a format like "Fish, X.." from appearing, but
|
||||
only when the pub.item.separator is a ".", otherwise it just leaves
|
||||
out the pub.item.separator. Does anyone know how we can test for
|
||||
$pub.item.separator instead of '.'? -->
|
||||
<xsl:template match="r:author[substring(text(), string-length(text()))='.']" mode="final">
|
||||
<xsl:call-template name="DerefAuthor"/><xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format the last author -->
|
||||
<xsl:template match="r:author" mode="final">
|
||||
<xsl:call-template name="DerefAuthor"/>
|
||||
<xsl:value-of select="$pub.item.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format an author's name if provided or by reference to the name with the given id. -->
|
||||
<xsl:template name="DerefAuthor">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@name">
|
||||
<xsl:apply-templates select="id(@name)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Title of book -->
|
||||
<xsl:template match="r:bookTitle">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:value-of select="$pub.item.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Title of article -->
|
||||
<xsl:template match="r:artTitle">
|
||||
<xsl:text>"</xsl:text>
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>"</xsl:text>
|
||||
<xsl:value-of select="$pub.item.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Publisher with a following publication date. -->
|
||||
<xsl:template match="r:publisher[following-sibling::pubDate]">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Publisher without pub date -->
|
||||
<xsl:template match="r:publisher">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:value-of select="$pub.item.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format the publication date -->
|
||||
<!-- Note: the FormatPubDate name attr is used only so that this template can
|
||||
be called from the r:pubDate deprecation message. The name can be removed when
|
||||
r:pubDate is removed from the DTD. -->
|
||||
<xsl:template match="r:pub/r:date" name="FormatPubDate">
|
||||
<xsl:call-template name="FormatDate"/>
|
||||
<xsl:value-of select="$pub.item.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format the page numbers of the journal in which the article appeared -->
|
||||
<xsl:template match="r:pageNums">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:value-of select="$pub.item.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Format a URL -->
|
||||
<xsl:template match="r:pub/r:url">
|
||||
<xsl:call-template name="FormatUrl"/>
|
||||
<xsl:value-of select="$pub.item.separator"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
168
legacy-resumes/resume-1/xsl/lib/string.xsl
Normal file
168
legacy-resumes/resume-1/xsl/lib/string.xsl
Normal file
@@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
string.xsl
|
||||
Library of string processing templates.
|
||||
|
||||
Copyright (c) 2000-2002 by Vlad Korolev, Sean Kelly, Bruce Christensen
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$Id: string.xsl,v 1.1 2002/05/26 03:45:51 bruckie Exp $
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:r="http://xmlresume.sourceforge.net/resume/0.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<!-- Removes leading and trailing space -->
|
||||
<xsl:template name="Trim">
|
||||
<xsl:param name="Text"/>
|
||||
|
||||
<xsl:variable name="LeadingSpace">
|
||||
<xsl:call-template name="LeadingSpace">
|
||||
<xsl:with-param name="Text" select="$Text"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="LeadingLen" select="string-length($LeadingSpace)"/>
|
||||
|
||||
<xsl:variable name="TrailingSpace">
|
||||
<xsl:call-template name="TrailingSpace">
|
||||
<xsl:with-param name="Text" select="$Text"/>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="TrailingLen" select="string-length($TrailingSpace)"/>
|
||||
|
||||
<xsl:value-of
|
||||
select="substring(
|
||||
$Text,
|
||||
1+$LeadingLen,
|
||||
string-length($Text) - $LeadingLen - $TrailingLen
|
||||
)"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Like normalize-space(), but leaves leading and trailing space intact -->
|
||||
<xsl:template name="NormalizeInternalSpace">
|
||||
<xsl:param name="Text"/>
|
||||
|
||||
<xsl:call-template name="LeadingSpace">
|
||||
<xsl:with-param name="Text" select="$Text"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:value-of select="normalize-space($Text)"/>
|
||||
|
||||
<xsl:call-template name="TrailingSpace">
|
||||
<xsl:with-param name="Text" select="$Text"/>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Returns the leading whitespace of a string -->
|
||||
<xsl:template name="LeadingSpace">
|
||||
<xsl:param name="Text"/>
|
||||
|
||||
<xsl:variable name="Whitespace">
|
||||
<xsl:text> 	
</xsl:text>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:if test="string-length($Text) > 0">
|
||||
<xsl:variable name="First" select="substring($Text, 1, 1)"/>
|
||||
<xsl:variable name="Following" select="substring($Text, 2)"/>
|
||||
|
||||
<xsl:if test="contains($Whitespace, $First)">
|
||||
<xsl:value-of select="$First"/>
|
||||
<xsl:call-template name="LeadingSpace">
|
||||
<xsl:with-param name="Text" select="$Following"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Returns the trailing whitespace of a string -->
|
||||
<xsl:template name="TrailingSpace">
|
||||
<xsl:param name="Text"/>
|
||||
|
||||
<xsl:variable name="Whitespace">
|
||||
<xsl:text> 	
</xsl:text>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:if test="string-length($Text) > 0">
|
||||
<xsl:variable name="Last"
|
||||
select="substring($Text, string-length($Text))"/>
|
||||
<xsl:variable name="Preceding"
|
||||
select="substring($Text, 1, string-length($Text) -1)"/>
|
||||
|
||||
<xsl:if test="contains($Whitespace, $Last)">
|
||||
<xsl:call-template name="TrailingSpace">
|
||||
<xsl:with-param name="Text" select="$Preceding"/>
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="$Last"/>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
Replaces $Max-Replacements occurrences (default: as many as possible) of
|
||||
$Search-For in $Text with $Replace-With.
|
||||
|
||||
Based on Sean's PreserveLineBreaks. *BC*
|
||||
-->
|
||||
<xsl:template name="String-Replace">
|
||||
<xsl:param name="Text"/>
|
||||
<xsl:param name="Search-For"/>
|
||||
<xsl:param name="Replace-With"/>
|
||||
<!-- less than 0 = as many replacements as possible -->
|
||||
<xsl:param name="Max-Replacements">-1</xsl:param>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="($Max-Replacements != 0) and contains($Text, $Search-For)">
|
||||
<xsl:value-of select="substring-before($Text, $Search-For)"/>
|
||||
<xsl:copy-of select="$Replace-With"/>
|
||||
<xsl:call-template name="String-Replace">
|
||||
<xsl:with-param
|
||||
name="Text"
|
||||
select="substring-after($Text, $Search-For)"/>
|
||||
<xsl:with-param
|
||||
name="Search-For"
|
||||
select="$Search-For"/>
|
||||
<xsl:with-param
|
||||
name="Replace-With"
|
||||
select="$Replace-With"/>
|
||||
<xsl:with-param
|
||||
name="Max-Replacements"
|
||||
select="$Max-Replacements - 1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$Text"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
365
legacy-resumes/resume-1/xsl/lib/textlayout.xsl
Normal file
365
legacy-resumes/resume-1/xsl/lib/textlayout.xsl
Normal file
@@ -0,0 +1,365 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
textlayout.xsl
|
||||
Library of plain-text layout helper templates.
|
||||
|
||||
- This library differs from text.xsl in that it has no XML Resume-specific
|
||||
code.
|
||||
- This library differs from string.xsl in that string.xsl provides templates
|
||||
that are useful to any application that may need to do text processing; this
|
||||
library is likely to be useful only when doing plain text output.
|
||||
- This library could forseeably be used in a different project that needs to do
|
||||
text layout in XSLT.
|
||||
|
||||
Copyright (c) 2000-2002 by Vlad Korolev, Sean Kelly, and Bruce Christensen
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
$Id: textlayout.xsl,v 1.3 2002/11/25 02:35:22 brandondoyle Exp $
|
||||
-->
|
||||
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:r="http://xmlresume.sourceforge.net/resume/0.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:template name="NewLine">
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Create a heading. -->
|
||||
<xsl:template name="Heading">
|
||||
<xsl:param name="Text"/>
|
||||
|
||||
<xsl:call-template name="NewLine"/>
|
||||
<xsl:call-template name="NewLine"/>
|
||||
<xsl:value-of select="$Text"/><xsl:text>:</xsl:text>
|
||||
<xsl:call-template name="NewLine"/>
|
||||
<xsl:call-template name="NewLine"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="NSpace">
|
||||
<xsl:param name="n" select="0"/>
|
||||
<xsl:if test="$n > 0">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:call-template name="NSpace">
|
||||
<xsl:with-param name="n" select="$n - 1" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="Indent">
|
||||
<xsl:param name="Length" select="$text.indent.width"/>
|
||||
<xsl:param name="Text"/>
|
||||
|
||||
<!-- Put Space -->
|
||||
<xsl:call-template name="NSpace">
|
||||
<xsl:with-param name="n" select="$Length"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<!-- Display One Line -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($Text,'
')">
|
||||
<xsl:value-of select="substring-before($Text,'
')"/>
|
||||
<xsl:call-template name="NewLine"/>
|
||||
<xsl:call-template name="Indent">
|
||||
<xsl:with-param name="Length" select="$Length"/>
|
||||
<xsl:with-param name="Text" select="substring-after($Text,'
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$Text"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<!-- Continue with the rest -->
|
||||
</xsl:template>
|
||||
|
||||
<!-- Center a multi-line block of text -->
|
||||
<xsl:template name="CenterBlock">
|
||||
<xsl:param name="Width" select="$text.width"/>
|
||||
<xsl:param name="Text" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($Text,'
')">
|
||||
<xsl:call-template name="Center">
|
||||
<xsl:with-param name="Text" select="substring-before($Text,'
')"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
</xsl:call-template>
|
||||
<xsl:call-template name="NewLine"/>
|
||||
<xsl:call-template name="CenterBlock">
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="Text" select="substring-after($Text,'
')"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="Center">
|
||||
<xsl:with-param name="Text" select="$Text"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Center a single line of text -->
|
||||
<xsl:template name="Center">
|
||||
<xsl:param name="Width" select="$text.width"/>
|
||||
<xsl:param name="Text" />
|
||||
|
||||
<xsl:if test="string-length($Text) > 0">
|
||||
<xsl:call-template name="NSpace">
|
||||
<xsl:with-param
|
||||
name="n"
|
||||
select="($Width - string-length($Text)) div 2" />
|
||||
</xsl:call-template>
|
||||
<xsl:value-of select="$Text"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Named template for formatting a generic bullet list item *SE* -->
|
||||
<!-- Simply calls Wrap to do a hanging indent of the bullet character and
|
||||
$Text. -->
|
||||
<xsl:template name="FormatBulletListItem" >
|
||||
<xsl:param name="Text"/>
|
||||
<!-- Note: This is the max width of the lines outputted, *including the
|
||||
bullet* -->
|
||||
<xsl:param name="Width" select="$text.width - $text.indent.width"/>
|
||||
|
||||
<xsl:call-template name="Wrap">
|
||||
<xsl:with-param name="Text">
|
||||
<xsl:value-of select="$text.bullet.prefix"/>
|
||||
<xsl:value-of select="normalize-space($Text)"/>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="FirstIndent" select="0"/>
|
||||
<xsl:with-param name="Indent" select="string-length($text.bullet.prefix)"/>
|
||||
<xsl:with-param name="KeepNewlines" select="1"/>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Wraps $Text to $Width characters(*). Whitespace in input text is
|
||||
normalized before processing, with the exception of newlines if $KeepNewlines
|
||||
is true.
|
||||
|
||||
The first line outputted will be indented $FirstIndent spaces (Default:
|
||||
$Indent.)
|
||||
|
||||
All subsequent lines will be indented $Indent spaces. (Default: 0.)
|
||||
|
||||
$FirstIndent and $Indent are both measured from column zero; that is, they're
|
||||
independent of each other. If $FirstIndent is 0, and $Indent is 3, you'll get
|
||||
text shaped like this:
|
||||
|
||||
a b c d e f g h i j
|
||||
k l m n o p q r s
|
||||
t u v w x y z
|
||||
|
||||
Spaces used for indenting count toward $Width.
|
||||
|
||||
(*) If $Text contains a word that's longer than $Width, that word will be
|
||||
output on a line by itself, causing the width of the outputted text to be
|
||||
greater than $Width. Words are separated by spaces. -->
|
||||
<xsl:template name="Wrap">
|
||||
<!-- Text to wrap -->
|
||||
<xsl:param name="Text"/>
|
||||
<!-- Maximum line length; lines longer than this get wrapped -->
|
||||
<xsl:param name="Width" select="$text.width - $text.indent.width"/>
|
||||
<!-- Whether newlines in $Text should be kept. -->
|
||||
<xsl:param name="KeepNewlines" select="0"/>
|
||||
<!-- Number of characters to indent each line. If $FirstIndent is specified,
|
||||
the first line is indented that many characters instead. -->
|
||||
<xsl:param name="Indent" select="0"/>
|
||||
<!-- Number of characters to indent first line -->
|
||||
<xsl:param name="FirstIndent" select="$Indent"/>
|
||||
|
||||
<!-- Number of characters outputted on the current line -->
|
||||
<xsl:param name="CPos" select="0"/>
|
||||
<!-- Is the current line the first line? -->
|
||||
<xsl:param name="IsFirstLine" select="1"/>
|
||||
<!-- Has $Text been normalized? -->
|
||||
<xsl:param name="IsNormalized" select="0"/>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="string-length($Text) = 0">
|
||||
<!-- Basis case; we're done. -->
|
||||
</xsl:when>
|
||||
|
||||
<!-- Keep newlines if requested. (Basic idea is to split on newlines, do
|
||||
wrapping on each part, and then join results with newlines.) -->
|
||||
<xsl:when test="$KeepNewlines and contains($Text, '
')">
|
||||
|
||||
<xsl:variable name="Before" select="substring-before($Text, '
')"/>
|
||||
<xsl:variable name="After" select="substring-after($Text, '
')"/>
|
||||
|
||||
<xsl:call-template name="Wrap">
|
||||
<xsl:with-param name="Text" select="$Before"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="FirstIndent" select="$FirstIndent"/>
|
||||
<xsl:with-param name="Indent" select="$Indent"/>
|
||||
<xsl:with-param name="KeepNewlines" select="1"/>
|
||||
<xsl:with-param name="IsFirstLine" select="$IsFirstLine"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:call-template name="NewLine"/>
|
||||
|
||||
<xsl:call-template name="Wrap">
|
||||
<xsl:with-param name="Text" select="$After"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="FirstIndent" select="$FirstIndent"/>
|
||||
<xsl:with-param name="Indent" select="$Indent"/>
|
||||
<xsl:with-param name="KeepNewlines" select="1"/>
|
||||
<xsl:with-param name="IsFirstLine" select="0"/>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="not($IsNormalized)">
|
||||
<xsl:call-template name="Wrap">
|
||||
<xsl:with-param name="Text" select="normalize-space($Text)"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="FirstIndent" select="$FirstIndent"/>
|
||||
<xsl:with-param name="Indent" select="$Indent"/>
|
||||
<xsl:with-param name="CPos" select="0"/>
|
||||
<xsl:with-param name="IsFirstLine" select="$IsFirstLine"/>
|
||||
<xsl:with-param name="IsNormalized" select="1"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<!-- If we're here, text non-empty, normalized, and newline-free. We just
|
||||
have to output the next word, or, if that would cause the line to become
|
||||
too long, output a newline. -->
|
||||
<xsl:otherwise>
|
||||
|
||||
<xsl:variable name="Word">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($Text,' ')">
|
||||
<xsl:value-of select="substring-before($Text,' ')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$Text"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="WordWidth" select="string-length($Word)"/>
|
||||
|
||||
<!-- Number of spaces to output before $Word -->
|
||||
<xsl:variable name="SpaceWidth">
|
||||
<!-- We're at the beginning of the line, so we may need to indent -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$CPos=0">
|
||||
<xsl:choose>
|
||||
<!-- We're on the first line -->
|
||||
<xsl:when test="$IsFirstLine">
|
||||
<xsl:value-of select="$FirstIndent"/>
|
||||
</xsl:when>
|
||||
<!-- We're on a following line -->
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$Indent"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- We're not at the beginning of the line, so we'll need just one
|
||||
space to separate this word from the previous one -->
|
||||
<xsl:otherwise>1</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<!-- If the word length is longer than the allowed line length, and
|
||||
we're at the start of the line, then output the word. (Without this
|
||||
case, we'd get stuck in endless recursion.) -->
|
||||
<xsl:when test="($CPos = 0) and ($SpaceWidth + $WordWidth > $Width)">
|
||||
|
||||
<xsl:call-template name="NSpace">
|
||||
<xsl:with-param name="n" select="$SpaceWidth"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:value-of select="$Word"/>
|
||||
|
||||
<xsl:call-template name="Wrap">
|
||||
<xsl:with-param name="Text" select="substring-after($Text, ' ')"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="FirstIndent" select="$FirstIndent"/>
|
||||
<xsl:with-param name="Indent" select="$Indent"/>
|
||||
<xsl:with-param name="CPos" select="$WordWidth"/>
|
||||
<xsl:with-param name="IsFirstLine" select="$IsFirstLine"/>
|
||||
<xsl:with-param name="IsNormalized" select="1"/>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:when>
|
||||
|
||||
<!-- If the word will make this line too long, make a new line and
|
||||
try again -->
|
||||
<xsl:when test="$CPos + $SpaceWidth + $WordWidth > $Width">
|
||||
|
||||
<xsl:call-template name="NewLine"/>
|
||||
|
||||
<xsl:call-template name="Wrap">
|
||||
<xsl:with-param name="Text" select="$Text"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="FirstIndent" select="$FirstIndent"/>
|
||||
<xsl:with-param name="Indent" select="$Indent"/>
|
||||
<xsl:with-param name="CPos" select="0"/>
|
||||
<xsl:with-param name="IsFirstLine" select="0"/>
|
||||
<xsl:with-param name="IsNormalized" select="1"/>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:when>
|
||||
|
||||
<!-- There's room on this line for the word, so output it, possibly
|
||||
prepended with a space -->
|
||||
<xsl:otherwise>
|
||||
|
||||
<xsl:call-template name="NSpace">
|
||||
<xsl:with-param name="n" select="$SpaceWidth"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:value-of select="$Word"/>
|
||||
|
||||
<xsl:call-template name="Wrap">
|
||||
<xsl:with-param name="Text" select="substring-after($Text, ' ')"/>
|
||||
<xsl:with-param name="Width" select="$Width"/>
|
||||
<xsl:with-param name="FirstIndent" select="$FirstIndent"/>
|
||||
<xsl:with-param name="Indent" select="$Indent"/>
|
||||
<xsl:with-param name="CPos"
|
||||
select="$CPos + $SpaceWidth + $WordWidth"/>
|
||||
<xsl:with-param name="IsFirstLine" select="$IsFirstLine"/>
|
||||
<xsl:with-param name="IsNormalized" select="1"/>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Reference in New Issue
Block a user