Added XSLTTemplate, functions that add it to transform area and documentation for that function (#144)
Co-authored-by: widlam <mikolaj.widla@gmail.com> Reviewed-on: #144 Reviewed-by: Adam Bem <bema@noreply.example.com> Co-authored-by: Mikolaj Widla <widlam@noreply.example.com> Co-committed-by: Mikolaj Widla <widlam@noreply.example.com>
This commit is contained in:
14
Frontend/assets/samples/XSLTTemplate.xslt
Normal file
14
Frontend/assets/samples/XSLTTemplate.xslt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:b="http://www.release11.com/book" xmlns:p="http://www.release11.com/person"
|
||||||
|
xmlns:l="http://www.release11.com/library">
|
||||||
|
<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>
|
||||||
@@ -84,6 +84,24 @@ function fillDefaultXML(element) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `fillDefaultXSLT()` function fetches a default XSLT template from the server and sets the value of the element with id "transformArea" to the fetched template.
|
||||||
|
*
|
||||||
|
* @function
|
||||||
|
* @name fillDefaultXSLT
|
||||||
|
* @kind function
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function fillDefaultXSLT() {
|
||||||
|
const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086";
|
||||||
|
fetch(serverAddress + "/assets/samples/XSLTTemplate.xslt")
|
||||||
|
.then( response => response.text() )
|
||||||
|
.then( (XSTLTemplate) => {
|
||||||
|
document.getElementById('transformArea').value = XSTLTemplate;
|
||||||
|
} )
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It sets default content for the element an changes it's color to grey
|
* It sets default content for the element an changes it's color to grey
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -51,7 +51,14 @@
|
|||||||
onfocus="clearDefaultContent(this, 'Insert XML here');"></textarea>
|
onfocus="clearDefaultContent(this, 'Insert XML here');"></textarea>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
|
<div class="display-space-between">
|
||||||
<label for="transformArea"><b>Insert your XSLT:</b></label>
|
<label for="transformArea"><b>Insert your XSLT:</b></label>
|
||||||
|
<div>
|
||||||
|
<button class="action-button active" id="defaultXSLTButton" style="padding: 3px 10px;"
|
||||||
|
onclick="fillDefaultXSLT()">Insert default XSLT
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<textarea id="transformArea" name="transformArea" rows="15"
|
<textarea id="transformArea" name="transformArea" rows="15"
|
||||||
class="textarea-300 bordered-field vertically-resizeable max-width"
|
class="textarea-300 bordered-field vertically-resizeable max-width"
|
||||||
onblur="setDefaultContent(this, 'Insert XSLT here');"
|
onblur="setDefaultContent(this, 'Insert XSLT here');"
|
||||||
|
|||||||
Reference in New Issue
Block a user