dcclib.transformation ¶
Transformable ¶
Bases: ABC
Abstract base class for classes that can perform transformations on a string, file path, or tree structure.
transform_file
abstractmethod
¶
transform_file(xml_path: str) -> str
Transform an XML file.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_str
abstractmethod
¶
transform_str(xml_content: str) -> str
Transform an XML.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_tree
abstractmethod
¶
transform_tree(xml_tree: etree.Element) -> str
Transform an XML tree.
| Parameters: |
|
|---|
| Returns: |
|
|---|
XsltProcessor ¶
XsltProcessor(xslt: str, cwd: str = os.getcwd())
Bases: Constructible, Transformable
Processor for XSLT transformations.
Initializes the XSLT processor with the given XSLT string.
| Parameters: |
|
|---|
from_file
classmethod
¶
from_file(path: str)
Create an XsltProcessor from a file path.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_str
classmethod
¶
from_str(string: str)
Create an XsltProcessor from a string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_tree
classmethod
¶
from_tree(tree: etree.Element)
Create an XsltProcessor from an etree.Element tree.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_file ¶
transform_file(xml_path: str) -> str
Transforms an XML file with the xslt string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_str ¶
transform_str(xml_content: str) -> str
Transforms a xml with the xslt string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_tree ¶
transform_tree(xml_tree: etree.Element) -> str
Transforms an XML tree with the xslt string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transformable ¶
Transformable ¶
Bases: ABC
Abstract base class for classes that can perform transformations on a string, file path, or tree structure.
transform_file
abstractmethod
¶
transform_file(xml_path: str) -> str
Transform an XML file.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_str
abstractmethod
¶
transform_str(xml_content: str) -> str
Transform an XML.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_tree
abstractmethod
¶
transform_tree(xml_tree: etree.Element) -> str
Transform an XML tree.
| Parameters: |
|
|---|
| Returns: |
|
|---|
xslt ¶
XsltProcessor ¶
XsltProcessor(xslt: str, cwd: str = os.getcwd())
Bases: Constructible, Transformable
Processor for XSLT transformations.
Initializes the XSLT processor with the given XSLT string.
| Parameters: |
|
|---|
from_file
classmethod
¶
from_file(path: str)
Create an XsltProcessor from a file path.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_str
classmethod
¶
from_str(string: str)
Create an XsltProcessor from a string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_tree
classmethod
¶
from_tree(tree: etree.Element)
Create an XsltProcessor from an etree.Element tree.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_file ¶
transform_file(xml_path: str) -> str
Transforms an XML file with the xslt string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_str ¶
transform_str(xml_content: str) -> str
Transforms a xml with the xslt string.
| Parameters: |
|
|---|
| Returns: |
|
|---|
transform_tree ¶
transform_tree(xml_tree: etree.Element) -> str
Transforms an XML tree with the xslt string.
| Parameters: |
|
|---|
| Returns: |
|
|---|