|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.infinityloop.util.xslt.ExtensionFunctions
public class ExtensionFunctions
This class encapsulates XSLT extension function implementations for some often-needed handy utilities.
Except when noted otherwise for a function, the general usage pattern is as follows:
<xsl:stylesheet>
element, e.g.:
xmlns:ilext="java:de.infinityloop.util.xslt.ExtensionFunctions"
(for Saxon) or
xmlns:ilext="xalan://de.infinityloop.util.xslt.ExtensionFunctions"
(for Xalan)
ilext:functionName( ...parameters if any... )
<xsl:stylesheet>
element:
exclude-result-prefixes="ilext ...other prefixes..."
Example:
<xsl:value-of select="ilext:URLToLocal(@href)" />
The above converts the value of the href
attribute, which is supposed to be a URI reference, to local file naming convention.
Constructor Summary | |
---|---|
ExtensionFunctions()
|
Method Summary | |
---|---|
static java.lang.String |
addLengths(java.lang.String length1,
java.lang.String length2,
java.lang.String resultDimension)
Adds two absolute length values, even if using different dimensions. |
static java.lang.String |
localToURL(java.lang.String local)
Returns the URL representation of the passed local filename. |
static java.lang.String |
makeValidXML_ID(java.lang.String src)
Transform a passed string in such a way that the result conforms to the rules for an XML 1.0 'Name' (as used e.g. for element names or xml:id). |
static java.lang.String |
makeValidXMLName(java.lang.String src)
Transform a passed string in such a way that the result conforms to the rules for an XML 1.0 'Name' (as used e.g. for element names or xml:id). |
static java.lang.String |
multiplyLength(java.lang.String length,
double factor,
java.lang.String resultDimension)
Multiply an absolute length by some factor. |
static java.lang.String |
subtractLengths(java.lang.String length1,
java.lang.String length2,
java.lang.String resultDimension)
Subtracts two absolute length values, even if using different dimensions. |
static java.lang.String |
URLToLocal(java.lang.String url)
Returns the local file name representation of the passed URL, if it's a file: URL; returns the normalized URL otherwise. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtensionFunctions()
Method Detail |
---|
public static java.lang.String localToURL(java.lang.String local)
local
- the file name in local format
public static java.lang.String URLToLocal(java.lang.String url)
url
- the file name in URL format
public static java.lang.String addLengths(java.lang.String length1, java.lang.String length2, java.lang.String resultDimension)
length1
- the first length, e.g. "2mm"length2
- the second length to add, e.g. "3.67in"resultDimension
- the dimension the result should be returned in, e.g. "cm"
public static java.lang.String subtractLengths(java.lang.String length1, java.lang.String length2, java.lang.String resultDimension)
length1
- the first length, e.g. "2mm"length2
- the length to subtract from length1, e.g. "3.67in"resultDimension
- the dimension the result should be returned in, e.g. "cm"
public static java.lang.String multiplyLength(java.lang.String length, double factor, java.lang.String resultDimension)
length
- the first length, e.g. "2mm"factor
- the factor to multiply the length with, e.g. "2.54"resultDimension
- the dimension the result should be returned in, e.g. "cm"
public static java.lang.String makeValidXMLName(java.lang.String src)
:
'
will not be allowed by this function, as it has special meaning in XML Namespaces. Therefore, consider
the passed string as only the local name of an element.
Important Note: This method does not guarantee that for different source
strings the output will be different as well! For example, both 1elem
and _1elem
will be converted
to _1elem
: The first will be modified by prepending a '_', while the second is already a valid
XML Name and therefore passed unchanged.
src
- the source string
Name
production.public static java.lang.String makeValidXML_ID(java.lang.String src)
makeValidXMLName()
, but additionally allows the colon character ':
' .
Important Note: This method does not guarantee that for different source
strings the output will be different as well! For example, both 1elem
and _1elem
will be converted
to _1elem
: The first will be modified by prepending a '_', while the second is already a valid
XML Name and therefore passed unchanged.
src
- the source string
Name
production.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |