Fixed #94 and done some refactoring (#99)

Co-authored-by: Adam Bem <adam.bem@zoho.eu>
Reviewed-on: R11/release11-tools-web#99
This commit is contained in:
2023-03-03 10:43:32 +01:00
parent fd95d7e845
commit 02f46169d9
13 changed files with 51 additions and 194 deletions

View File

@@ -1,31 +1,18 @@
from lxml import etree
from io import BytesIO
def prettify(source: str) -> str:
"""Method used to pretty format given XML
def formatXML(source: str, prettify: bool) -> str:
"""Method used to format XML
:param source: XML
:return: prettified XML
:param source: XML to format
:param prettify: sets if XML must be prettified
(added indentations etc.) or not
:return: formatted XML
"""
prolog = ""
prolog_start = source.find("<?")
if prolog_start != -1:
prolog_end = source.find("?>") + 2
prolog = source[prolog_start:prolog_end] + "\n"
source = source[prolog_end: ]
parser = etree.XMLParser(remove_blank_text=True)
xml = etree.fromstring(source, parser=parser)
return prolog + etree.tostring(xml, pretty_print=True).decode()
def minimize(source: str) -> str:
"""Method used to minimize XML by deleting not needed whitespaces.
:param source: XML
:return: minimized XML
"""
# Prolog is removed when XML is parsed
# so program has to copy it
prolog = ""
prolog_start = source.find("<?")
@@ -34,9 +21,14 @@ def minimize(source: str) -> str:
prolog = source[prolog_start:prolog_end]
source = source[prolog_end: ]
byte_input = BytesIO(source.encode("utf-8"))
parser = etree.XMLParser(remove_blank_text=True)
xml = etree.fromstring(source, parser=parser)
return prolog + etree.tostring(xml, pretty_print=False).decode()
xml = etree.parse(byte_input, parser=parser)
if prettify:
prolog += "\n"
return prolog + etree.tostring(xml, pretty_print=prettify).decode()
def xpath(source: str, xpath: str) -> str:
@@ -48,8 +40,8 @@ def xpath(source: str, xpath: str) -> str:
:return: Nodes selected using XPath
"""
root = etree.XML(source)
byte_input = BytesIO(source.encode("utf-8"))
root = etree.parse(byte_input).getroot()
nsmap = root.nsmap
# LXML doesn't accept empty (None) namespace prefix,
@@ -61,7 +53,7 @@ def xpath(source: str, xpath: str) -> str:
# root.xpath can return 4 types: float, string, bool and list.
# List is the only one that can't be simply converted to str
if result is not list:
if type(result) is not list:
return str(result)
else:
result_string = ""
@@ -78,9 +70,13 @@ def xsd(source: str, xsd: str) -> bool:
:param xsd: XSD schema to validate XML against
:return: Message saying, if the validation was successful or not
"""
xml_schema = etree.XMLSchema(etree.XML(xsd))
xml = etree.XML(source)
schema_input = BytesIO(xsd.encode("utf-8"))
xml_schema = etree.XMLSchema(etree.parse(schema_input).getroot())
document_input = BytesIO(source.encode("utf-8"))
xml = etree.parse(document_input).getroot()
if xml_schema.validate(xml):
return "XML is valid."
else:
@@ -89,16 +85,17 @@ def xsd(source: str, xsd: str) -> bool:
def xslt(source: str, xslt: str) -> str:
"""
Method used to transformate XML string using XSLT
Method used to transform XML string using XSLT
:param source: XML string to transform
:param xslt: XSLT string used to transformate XML
:param xslt: XSLT string used to transform XML
:return: Result of transformation
"""
xslt_transform = etree.XSLT(etree.XML(xslt))
xslt_input = BytesIO(xslt.encode("utf-8"))
xslt_transform = etree.XSLT(etree.parse(xslt_input))
xml = etree.XML(source)
document_input = BytesIO(source.encode("utf-8"))
xml = etree.parse(document_input).getroot()
transformated = xslt_transform(xml)
print(transformated)
return str(transformated)
transformed = str(xslt_transform(xml))
return formatXML(transformed, True)

View File

@@ -15,43 +15,6 @@ cors = CORS(app, resource={
}
})
def format_xml(request: request, type: str) -> str:
"""Function to format XML
:param request: Received request
:param type: Type of needed processing: xsd, xslt or xpath
:raises ValueError: is raised when type is different than those provided above
:return: response JSON converted to string and response code
"""
start = time.time_ns()
code = 200
response_json = dict()
try:
request_data = json.loads(request.get_data(as_text=True))
data = request_data['data']
process = request_data['process']
if (type == "prettify"):
response_json['result'] = Parser.xsd(data, process)
elif (type == "minimize"):
response_json['result'] = Parser.xslt(data, process)
else:
raise ValueError("Valid operation types are: prettify, minimize")
response_json['status'] = "OK"
except KeyError as e:
response_json['result'] = "Missing key: " + str(e)
response_json['status'] = "ERR"
code = 400
except Exception as e:
response_json['result'] = str(e)
response_json['status'] = "ERR"
code = 400
finally:
exec_time = (time.time_ns() - start) / 10**6
response_json['time'] = f"{exec_time:.03f}"
response_json['processor'] = "libxml2 over lxml"
return json.dumps(response_json), code
def process_xml(request: request, type: str) -> str:
"""Function to process
@@ -74,9 +37,9 @@ def process_xml(request: request, type: str) -> str:
elif (type == "xpath"):
response_json['result'] = Parser.xpath(data, process)
elif (type == "prettify"):
response_json['result'] = Parser.prettify(data)
response_json['result'] = Parser.formatXML(data, True)
elif (type == "minimize"):
response_json['result'] = Parser.minimize(data)
response_json['result'] = Parser.formatXML(data, False)
else:
raise ValueError("Valid operation types are: xsd, xslt, xpath")

View File

@@ -1,3 +1,3 @@
url = "http://localhost:5000/minimizepost"
url = "http://localhost:5000/minimize"
data = "@minimize.json"
request = POST

View File

@@ -1,104 +0,0 @@
<b:books xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.demo.com" xmlns:b="http://www.book.com" xmlns:a="http://www.author.com">
<b:book id="1">
<b:name>Hamlet</b:name>
<b:date>2001-05-04</b:date>
<a:authorId>1</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="2">
<b:name>Macbeth</b:name>
<b:date>2000-12-13</b:date>
<a:authorId>1</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="3">
<b:name>Harry Potter and the Sorcerer's Stone</b:name>
<b:date>2005-04-29</b:date>
<a:authorId>2</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="4">
<b:name>The Long Walk</b:name>
<b:date>2018-07-01</b:date>
<a:authorId>4</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="5">
<b:name>Misery</b:name>
<b:date>2018-01-31</b:date>
<a:authorId>4</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="6">
<b:name>Think and Grow Rich</b:name>
<b:date>2004-09-10</b:date>
<a:authorId>6</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="7">
<b:name>The Law of Success</b:name>
<b:date>1982-05-09</b:date>
<a:authorId>6</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="8">
<b:name>Patriot Games</b:name>
<b:date>1995-10-21</b:date>
<a:authorId>5</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="9">
<b:name>The Sum of All Fears</b:name>
<b:date>1992-09-19</b:date>
<a:authorId>5</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="10">
<b:name>The Alchemist</b:name>
<b:date>2017-02-20</b:date>
<a:authorId>3</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="11">
<b:name>Hamlet</b:name>
<b:date>1994-06-01</b:date>
<a:authorId>1</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="12">
<b:name>Measure for Measure</b:name>
<b:date>1990-03-23</b:date>
<a:authorId>1</a:authorId>
<b:availability>false</b:availability>
</b:book>
<b:book id="13">
<b:name>Hamlet</b:name>
<b:date>1989-05-05</b:date>
<a:authorId>1</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="14">
<b:name>Hamlet</b:name>
<b:date>1999-05-30</b:date>
<a:authorId>1</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="15">
<b:name>The Law of Success</b:name>
<b:date>2004-11-26</b:date>
<a:authorId>6</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="16">
<b:name>Romeo and Juliet</b:name>
<b:date>1997-02-08</b:date>
<a:authorId>1</a:authorId>
<b:availability>true</b:availability>
</b:book>
<b:book id="17">
<b:name>The Alchemist</b:name>
<b:date>2009-08-21</b:date>
<a:authorId>3</a:authorId>
<b:availability>true</b:availability>
</b:book>
</b:books>

View File

@@ -1,3 +1,3 @@
url = "http://localhost:5000/prettifypost"
url = "http://localhost:5000/prettify"
data = "@prettify.json"
request = POST

View File

@@ -1,5 +1,5 @@
{
"data": "<books><book id='1'><name>Hamlet</name><date>2001-05-04</date><authorId>1</authorId><availability>false</availability></book><book id='2'><name>Macbeth</name><date>2000-12-13</date><authorId>1</authorId><availability>false</availability></book><book id='3'><name>Harry Potter and the Sorcerer's Stone</name><date>2005-04-29</date><authorId>2</authorId><availability>true</availability></book><book id='4'><name>The Long Walk</name><date>2018-07-01</date><authorId>4</authorId><availability>true</availability></book><book id='5'><name>Misery</name><date>2018-01-31</date><authorId>4</authorId><availability>true</availability></book><book id='6'><name>Think and Grow Rich</name><date>2004-09-10</date><authorId>6</authorId><availability>true</availability></book><book id='7'><name>The Law of Success</name><date>1982-05-09</date><authorId>6</authorId><availability>false</availability></book><book id='8'><name>Patriot Games</name><date>1995-10-21</date><authorId>5</authorId><availability>false</availability></book><book id='9'><name>The Sum of All Fears</name><date>1992-09-19</date><authorId>5</authorId><availability>false</availability></book><book id='10'><name>The Alchemist</name><date>2017-02-20</date><authorId>3</authorId><availability>false</availability></book><book id='11'><name>Hamlet</name><date>1994-06-01</date><authorId>1</authorId><availability>false</availability></book><book id='12'><name>Measure for Measure</name><date>1990-03-23</date><authorId>1</authorId><availability>false</availability></book><book id='13'><name>Hamlet</name><date>1989-05-05</date><authorId>1</authorId><availability>true</availability></book><book id='14'><name>Hamlet</name><date>1999-05-30</date><authorId>1</authorId><availability>true</availability></book><book id='15'><name>The Law of Success</name><date>2004-11-26</date><authorId>6</authorId><availability>true</availability></book><book id='16'><name>Romeo and Juliet</name><date>1997-02-08</date><authorId>1</authorId><availability>true</availability></book><book id='17'><name>The Alchemist</name><date>2009-08-21</date><authorId>3</authorId><availability>true</availability></book></books>",
"data": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<books><book id='1'><name>Hamlet</name><date>2001-05-04</date><authorId>1</authorId><availability>false</availability></book><book id='2'><name>Macbeth</name><date>2000-12-13</date><authorId>1</authorId><availability>false</availability></book><book id='3'><name>Harry Potter and the Sorcerer's Stone</name><date>2005-04-29</date><authorId>2</authorId><availability>true</availability></book><book id='4'><name>The Long Walk</name><date>2018-07-01</date><authorId>4</authorId><availability>true</availability></book><book id='5'><name>Misery</name><date>2018-01-31</date><authorId>4</authorId><availability>true</availability></book><book id='6'><name>Think and Grow Rich</name><date>2004-09-10</date><authorId>6</authorId><availability>true</availability></book><book id='7'><name>The Law of Success</name><date>1982-05-09</date><authorId>6</authorId><availability>false</availability></book><book id='8'><name>Patriot Games</name><date>1995-10-21</date><authorId>5</authorId><availability>false</availability></book><book id='9'><name>The Sum of All Fears</name><date>1992-09-19</date><authorId>5</authorId><availability>false</availability></book><book id='10'><name>The Alchemist</name><date>2017-02-20</date><authorId>3</authorId><availability>false</availability></book><book id='11'><name>Hamlet</name><date>1994-06-01</date><authorId>1</authorId><availability>false</availability></book><book id='12'><name>Measure for Measure</name><date>1990-03-23</date><authorId>1</authorId><availability>false</availability></book><book id='13'><name>Hamlet</name><date>1989-05-05</date><authorId>1</authorId><availability>true</availability></book><book id='14'><name>Hamlet</name><date>1999-05-30</date><authorId>1</authorId><availability>true</availability></book><book id='15'><name>The Law of Success</name><date>2004-11-26</date><authorId>6</authorId><availability>true</availability></book><book id='16'><name>Romeo and Juliet</name><date>1997-02-08</date><authorId>1</authorId><availability>true</availability></book><book id='17'><name>The Alchemist</name><date>2009-08-21</date><authorId>3</authorId><availability>true</availability></book></books>",
"process": "/books/book[name = 'The Law of Success']",
"processor": "saxon",
"version": "2.0"

View File

@@ -1,5 +1,5 @@
{
"data": "<b:books xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.demo.com' xmlns:b='http://www.book.com' xmlns:a='http://www.author.com'><b:book id='1'><b:name>Hamlet</b:name><b:date>2001-05-04</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='2'><b:name>Macbeth</b:name><b:date>2000-12-13</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='3'><b:name>Harry Potter and the Sorcerer's Stone</b:name><b:date>2005-04-29</b:date><a:authorId>2</a:authorId><b:availability>true</b:availability></b:book><b:book id='4'><b:name>The Long Walk</b:name><b:date>2018-07-01</b:date><a:authorId>4</a:authorId><b:availability>true</b:availability></b:book><b:book id='5'><b:name>Misery</b:name><b:date>2018-01-31</b:date><a:authorId>4</a:authorId><b:availability>true</b:availability></b:book><b:book id='6'><b:name>Think and Grow Rich</b:name><b:date>2004-09-10</b:date><a:authorId>6</a:authorId><b:availability>true</b:availability></b:book><b:book id='7'><b:name>The Law of Success</b:name><b:date>1982-05-09</b:date><a:authorId>6</a:authorId><b:availability>false</b:availability></b:book><b:book id='8'><b:name>Patriot Games</b:name><b:date>1995-10-21</b:date><a:authorId>5</a:authorId><b:availability>false</b:availability></b:book><b:book id='9'><b:name>The Sum of All Fears</b:name><b:date>1992-09-19</b:date><a:authorId>5</a:authorId><b:availability>false</b:availability></b:book><b:book id='10'><b:name>The Alchemist</b:name><b:date>2017-02-20</b:date><a:authorId>3</a:authorId><b:availability>false</b:availability></b:book><b:book id='11'><b:name>Hamlet</b:name><b:date>1994-06-01</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='12'><b:name>Measure for Measure</b:name><b:date>1990-03-23</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='13'><b:name>Hamlet</b:name><b:date>1989-05-05</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='14'><b:name>Hamlet</b:name><b:date>1999-05-30</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='15'><b:name>The Law of Success</b:name><b:date>2004-11-26</b:date><a:authorId>6</a:authorId><b:availability>true</b:availability></b:book><b:book id='16'><b:name>Romeo and Juliet</b:name><b:date>1997-02-08</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='17'><b:name>The Alchemist</b:name><b:date>2009-08-21</b:date><a:authorId>3</a:authorId><b:availability>true</b:availability></b:book></b:books>",
"data": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<b:books xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.demo.com' xmlns:b='http://www.book.com' xmlns:a='http://www.author.com'><b:book id='1'><b:name>Hamlet</b:name><b:date>2001-05-04</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='2'><b:name>Macbeth</b:name><b:date>2000-12-13</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='3'><b:name>Harry Potter and the Sorcerer's Stone</b:name><b:date>2005-04-29</b:date><a:authorId>2</a:authorId><b:availability>true</b:availability></b:book><b:book id='4'><b:name>The Long Walk</b:name><b:date>2018-07-01</b:date><a:authorId>4</a:authorId><b:availability>true</b:availability></b:book><b:book id='5'><b:name>Misery</b:name><b:date>2018-01-31</b:date><a:authorId>4</a:authorId><b:availability>true</b:availability></b:book><b:book id='6'><b:name>Think and Grow Rich</b:name><b:date>2004-09-10</b:date><a:authorId>6</a:authorId><b:availability>true</b:availability></b:book><b:book id='7'><b:name>The Law of Success</b:name><b:date>1982-05-09</b:date><a:authorId>6</a:authorId><b:availability>false</b:availability></b:book><b:book id='8'><b:name>Patriot Games</b:name><b:date>1995-10-21</b:date><a:authorId>5</a:authorId><b:availability>false</b:availability></b:book><b:book id='9'><b:name>The Sum of All Fears</b:name><b:date>1992-09-19</b:date><a:authorId>5</a:authorId><b:availability>false</b:availability></b:book><b:book id='10'><b:name>The Alchemist</b:name><b:date>2017-02-20</b:date><a:authorId>3</a:authorId><b:availability>false</b:availability></b:book><b:book id='11'><b:name>Hamlet</b:name><b:date>1994-06-01</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='12'><b:name>Measure for Measure</b:name><b:date>1990-03-23</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='13'><b:name>Hamlet</b:name><b:date>1989-05-05</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='14'><b:name>Hamlet</b:name><b:date>1999-05-30</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='15'><b:name>The Law of Success</b:name><b:date>2004-11-26</b:date><a:authorId>6</a:authorId><b:availability>true</b:availability></b:book><b:book id='16'><b:name>Romeo and Juliet</b:name><b:date>1997-02-08</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='17'><b:name>The Alchemist</b:name><b:date>2009-08-21</b:date><a:authorId>3</a:authorId><b:availability>true</b:availability></b:book></b:books>",
"process": "/b:books/b:book[b:name = 'The Law of Success']",
"processor": "saxon",
"version": "2.0"

View File

@@ -1,4 +1,4 @@
#url = "localhost:8081/xpathpost"
url = "localhost:5000/xpathpost"
#url = "localhost:8081/xpath"
url = "localhost:5000/xpath"
request = "POST"
data = "@data.json"

View File

@@ -1,4 +1,4 @@
#url = "localhost:8081/xpathpost"
url = "localhost:5000/xpathpost"
#url = "localhost:8081/xpath"
url = "localhost:5000/xpath"
request = "POST"
data = "@dataNS.json"

View File

@@ -1,4 +1,4 @@
#url = "http://localhost:8082/xsdpost"
url = "http://localhost:5000/xsdpost"
#url = "http://localhost:8081/xsd"
url = "http://localhost:5000/xsd"
data = "@xsd.json"
request = POST

View File

@@ -1,6 +1,6 @@
{
"data": "<ns0:values xmlns:ns0 = \"http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd\"><ns0:value>Test</ns0:value><ns0:value>Test3</ns0:value></ns0:values>",
"process": "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd\" targetNamespace=\"http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd\" elementFormDefault=\"qualified\" attributeFormDefault=\"unqualified\"> <xs:element name=\"values\"><xs:complexType><xs:sequence><xs:element name=\"value\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"unbounded\"/></xs:sequence></xs:complexType></xs:element></xs:schema>",
"data": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ns0:values xmlns:ns0 = \"http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd\"><ns0:value>Test</ns0:value><ns0:value>Test3</ns0:value></ns0:values>",
"process": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd\" targetNamespace=\"http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd\" elementFormDefault=\"qualified\" attributeFormDefault=\"unqualified\"> <xs:element name=\"values\"><xs:complexType><xs:sequence><xs:element name=\"value\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"unbounded\"/></xs:sequence></xs:complexType></xs:element></xs:schema>",
"processor": "saxon",
"version": "1.0"
}

View File

@@ -1,3 +1,4 @@
url = "http://localhost:5000/xsltpost"
#url = "http://localhost:8081/xslt"
url = "http://localhost:5000/xslt"
data = "@xslt.json"
request = POST

View File

@@ -1,6 +1,6 @@
{
"data": "<b:books xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.demo.com' xmlns:b='http://www.book.com' xmlns:a='http://www.author.com'><b:book id='1'><b:name>Hamlet</b:name><b:date>2001-05-04</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='2'><b:name>Macbeth</b:name><b:date>2000-12-13</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='3'><b:name>Harry Potter and the Sorcerer's Stone</b:name><b:date>2005-04-29</b:date><a:authorId>2</a:authorId><b:availability>true</b:availability></b:book><b:book id='4'><b:name>The Long Walk</b:name><b:date>2018-07-01</b:date><a:authorId>4</a:authorId><b:availability>true</b:availability></b:book><b:book id='5'><b:name>Misery</b:name><b:date>2018-01-31</b:date><a:authorId>4</a:authorId><b:availability>true</b:availability></b:book><b:book id='6'><b:name>Think and Grow Rich</b:name><b:date>2004-09-10</b:date><a:authorId>6</a:authorId><b:availability>true</b:availability></b:book><b:book id='7'><b:name>The Law of Success</b:name><b:date>1982-05-09</b:date><a:authorId>6</a:authorId><b:availability>false</b:availability></b:book><b:book id='8'><b:name>Patriot Games</b:name><b:date>1995-10-21</b:date><a:authorId>5</a:authorId><b:availability>false</b:availability></b:book><b:book id='9'><b:name>The Sum of All Fears</b:name><b:date>1992-09-19</b:date><a:authorId>5</a:authorId><b:availability>false</b:availability></b:book><b:book id='10'><b:name>The Alchemist</b:name><b:date>2017-02-20</b:date><a:authorId>3</a:authorId><b:availability>false</b:availability></b:book><b:book id='11'><b:name>Hamlet</b:name><b:date>1994-06-01</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='12'><b:name>Measure for Measure</b:name><b:date>1990-03-23</b:date><a:authorId>1</a:authorId><b:availability>false</b:availability></b:book><b:book id='13'><b:name>Hamlet</b:name><b:date>1989-05-05</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='14'><b:name>Hamlet</b:name><b:date>1999-05-30</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='15'><b:name>The Law of Success</b:name><b:date>2004-11-26</b:date><a:authorId>6</a:authorId><b:availability>true</b:availability></b:book><b:book id='16'><b:name>Romeo and Juliet</b:name><b:date>1997-02-08</b:date><a:authorId>1</a:authorId><b:availability>true</b:availability></b:book><b:book id='17'><b:name>The Alchemist</b:name><b:date>2009-08-21</b:date><a:authorId>3</a:authorId><b:availability>true</b:availability></b:book></b:books>",
"process": "<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:b='http://www.demo.com'><xsl:template match='b:books'><Library><BookCount><xsl:value-of select='count(b:book)' /></BookCount></Library></xsl:template></xsl:stylesheet>",
"data": "<?xml version=\"1.0\" encoding=\"utf-8\"?><l:library xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.release11.com\" xmlns:l=\"http://www.release11.com/library\" xmlns:p=\"http://www.release11.com/person\" xmlns:b=\"http://www.release11.com/book\"><l:libraryName>City library</l:libraryName><l:libraryID>345123</l:libraryID><l:readerList><p:person><p:readerID>7321</p:readerID><p:name>Adam</p:name><p:surname>Choke</p:surname></p:person><p:person><p:readerID>5123</p:readerID><p:name>Lauren</p:name><p:surname>Wong</p:surname></p:person></l:readerList><l:bookList><b:book><b:bookID>6422</b:bookID><b:title>Harry Potter</b:title><p:readerID>7542</p:readerID></b:book><b:book><b:bookID>1234</b:bookID><b:title>Macbeth</b:title><p:readerID>5123</p:readerID></b:book><b:book><b:bookID>9556</b:bookID><b:title>Romeo and Juliet</b:title></b:book></l:bookList></l:library>",
"process": "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:b=\"http://www.demo.com\" xmlns:p=\"http://www.release11.com/person\" xmlns:l=\"http://www.release11.com/library\" version=\"1.0\"><xsl:template match=\"/\"><Library><ReaderCount><xsl:value-of select=\"count(//p:person)\"/></ReaderCount><BookCount><xsl:value-of select=\"count(/l:library/l:bookList/b:book)\"/></BookCount></Library></xsl:template></xsl:stylesheet>",
"processor": "saxon",
"version": "1.0"
}