Package com.jcabi.xml
Class XSLDocument
- java.lang.Object
-
- com.jcabi.xml.XSLDocument
-
- All Implemented Interfaces:
XSL
public final class XSLDocument extends Object implements XSL
Implementation ofXSL
.Objects of this class are immutable and thread-safe.
- Since:
- 0.4
- Suppressed Checkstyle violations:
- ClassDataAbstractionCouplingCheck (500 lines), AbbreviationAsWordInNameCheck (5 lines), ClassFanOutComplexityCheck (500 lines)
-
-
Constructor Summary
Constructors Constructor Description XSLDocument(XML src)
Public ctor, from XML as a source.XSLDocument(XML src, String base)
Public ctor, from XML as a source.XSLDocument(File file)
Public ctor, from file.XSLDocument(File file, String base)
Public ctor, from file with alternative SystemId.XSLDocument(InputStream stream)
Public ctor, from XSL as an input stream.XSLDocument(InputStream stream, String base)
Public ctor, from XSL as an input stream.XSLDocument(String src)
Public ctor, from XSL as a string.XSLDocument(String src, Sources srcs)
Public ctor, from XSL as a string.XSLDocument(String src, Sources srcs, String base)
Public ctor, from XSL as a string.XSLDocument(String src, Sources srcs, Map<String,Object> map)
Public ctor, from XSL as a string.XSLDocument(String src, Sources srcs, Map<String,Object> map, String base)
Public ctor, from XSL as a string.XSLDocument(String src, String base)
Public ctor, from XSL as a string.XSLDocument(URI uri)
Public ctor, from URI.XSLDocument(URI uri, String base)
Public ctor, from URI.XSLDocument(URL url)
Public ctor, from URL.XSLDocument(URL url, String base)
Public ctor, from URL with alternative SystemId.XSLDocument(Path file)
Public ctor, from file.XSLDocument(Path file, String base)
Public ctor, from file with custom SystemId.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
applyTo(XML xml)
Transform XML into text.static XSL
make(InputStream stream)
Make an instance of XSL stylesheet without I/O exceptions.static XSL
make(URL url)
Make an instance of XSL stylesheet without I/O exceptions.String
toString()
XML
transform(XML xml)
Transform XML to another one.XSL
with(Sources src)
With this sources.XSL
with(String name, Object value)
With this parameter.
-
-
-
Field Detail
-
STRIP
public static final XSL STRIP
Strips spaces of whitespace-only text nodes.This will NOT remove existing indentation between Element nodes currently introduced by the constructor of
XMLDocument
. For example:<a> <b> TXT </b> </a>
<a> <b> TXT </b> </a>
- Since:
- 0.14
-
-
Constructor Detail
-
XSLDocument
public XSLDocument(XML src)
Public ctor, from XML as a source.- Parameters:
src
- XSL document body
-
XSLDocument
public XSLDocument(XML src, String base)
Public ctor, from XML as a source.- Parameters:
src
- XSL document bodybase
- SystemId/Base- Since:
- 0.20
-
XSLDocument
public XSLDocument(URL url) throws IOException
Public ctor, from URL.- Parameters:
url
- Location of document- Throws:
IOException
- If fails to read- Since:
- 0.7.4
-
XSLDocument
public XSLDocument(URL url, String base) throws IOException
Public ctor, from URL with alternative SystemId.- Parameters:
url
- Location of documentbase
- SystemId/Base- Throws:
IOException
- If fails to read- Since:
- 0.26.0
-
XSLDocument
public XSLDocument(File file) throws FileNotFoundException
Public ctor, from file.- Parameters:
file
- Location of document- Throws:
FileNotFoundException
- If fails to read- Since:
- 0.21
-
XSLDocument
public XSLDocument(File file, String base) throws FileNotFoundException
Public ctor, from file with alternative SystemId.- Parameters:
file
- Location of documentbase
- SystemId/Base- Throws:
FileNotFoundException
- If fails to read- Since:
- 0.26.0
-
XSLDocument
public XSLDocument(Path file) throws FileNotFoundException
Public ctor, from file.- Parameters:
file
- Location of document- Throws:
FileNotFoundException
- If fails to read- Since:
- 0.21
-
XSLDocument
public XSLDocument(Path file, String base) throws FileNotFoundException
Public ctor, from file with custom SystemId.- Parameters:
file
- Location of documentbase
- SystemId/Base- Throws:
FileNotFoundException
- If fails to read- Since:
- 0.26.0
-
XSLDocument
public XSLDocument(URI uri) throws IOException
Public ctor, from URI.- Parameters:
uri
- Location of document- Throws:
IOException
- If fails to read- Since:
- 0.15
-
XSLDocument
public XSLDocument(URI uri, String base) throws IOException
Public ctor, from URI.- Parameters:
uri
- Location of documentbase
- SystemId/Base- Throws:
IOException
- If fails to read- Since:
- 0.26.0
-
XSLDocument
public XSLDocument(InputStream stream)
Public ctor, from XSL as an input stream.- Parameters:
stream
- XSL input stream
-
XSLDocument
public XSLDocument(InputStream stream, String base)
Public ctor, from XSL as an input stream.- Parameters:
stream
- XSL input streambase
- SystemId/Base- Since:
- 0.20
-
XSLDocument
public XSLDocument(String src)
Public ctor, from XSL as a string.- Parameters:
src
- XML document body
-
XSLDocument
public XSLDocument(String src, String base)
Public ctor, from XSL as a string.- Parameters:
src
- XML document bodybase
- SystemId/Base- Since:
- 0.20
-
XSLDocument
public XSLDocument(String src, Sources srcs)
Public ctor, from XSL as a string.- Parameters:
src
- XML document bodysrcs
- Sources- Since:
- 0.9
-
XSLDocument
public XSLDocument(String src, Sources srcs, String base)
Public ctor, from XSL as a string.- Parameters:
src
- XML document bodysrcs
- Sourcesbase
- SystemId/Base- Since:
- 0.20
-
XSLDocument
public XSLDocument(String src, Sources srcs, Map<String,Object> map)
Public ctor, from XSL as a string.- Parameters:
src
- XML document bodysrcs
- Sourcesmap
- Map of XSL params- Since:
- 0.16
-
XSLDocument
public XSLDocument(String src, Sources srcs, Map<String,Object> map, String base)
Public ctor, from XSL as a string.- Parameters:
src
- XML document bodysrcs
- Sourcesmap
- Map of XSL paramsbase
- SystemId/Base- Since:
- 0.20
- Suppressed Checkstyle violations:
- ParameterNumberCheck (5 lines)
-
-
Method Detail
-
with
public XSL with(String name, Object value)
Description copied from interface:XSL
With this parameter.
-
make
public static XSL make(InputStream stream)
Make an instance of XSL stylesheet without I/O exceptions.This factory method is useful when you need to create an instance of XSL stylesheet as a static final variable. In this case you can't catch an exception but this method can help, for example:
class Foo { private static final XSL STYLESHEET = XSLDocument.make( Foo.class.getResourceAsStream("my-stylesheet.xsl") ); }
- Parameters:
stream
- Input stream- Returns:
- XSL stylesheet
-
make
public static XSL make(URL url)
Make an instance of XSL stylesheet without I/O exceptions.- Parameters:
url
- URL with content- Returns:
- XSL stylesheet
- Since:
- 0.7.4
- See Also:
make(InputStream)
-
transform
public XML transform(XML xml)
Description copied from interface:XSL
Transform XML to another one.
-
-