Changes for page XSL-Transformation


From version 3.1
edited by gru
on 29.06.2021, 14:14
Change comment: Renamed back-links.
To version 4.1
edited by gru
on 16.01.2023, 12:44
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,3 +1,68 @@
1 1  Templates of type //XSL transformation// are utilized to transform an XML export file and can be used, for example, in actions of type [[Export (XML-File)>>doc:Formcycle.Designer.Workflow.Actions.ExportXML]] or for [[exporting a form record in an Inbox>>doc:Formcycle.Inbox.WebHome]].
2 2  
3 3  There are some tutorials on XSL transformation at [[w3schools>>url:https://www.w3schools.com/xml/xsl_transformation.asp]] and [[TutorialsPoint>>url:https://www.tutorialspoint.com/xslt/]].
4 +
5 +== Supported versions of the XSLT and XPath standards ==
6 +
7 +Up to and including {{formcycle/}} version 7.2.1, only //XSL transformations// using the XSLT 1.0 and XPath 1.0 language standards are supported.
8 +
9 +{{version major="7" minor="3" patch="0"/}}Starting with {{formcycle/}} version 7.3, a different processor is used, which supports XSLT 3.0 and XPath 3.1.
10 +
11 +== Differences in the use of XSL transformations in {{formcycle/}} version 7.3 or higher ==
12 +
13 +Basically, the XSLT processor used in newer {{formcycle/}} XSLT processor used in newer {{formcycle/}} versions supports all the language features that the older processor supported, since it is backward compatible with XSLT 1.0.
14 +
15 +However, the XSLT processor used in older {{formcycle/}} versions allowed certain statements that are not mandated by the language standard. This can cause existing XSL transformations to fail after updating to a {{formcycle/}} version greater than or equal to 7.3.
16 +
17 +So far, the following problems are known:
18 +
19 +=== Nested function calls ===
20 +
21 +Function calls in the form
22 +
23 +{{code language="xml"}}
24 +<xsl:variable name="dd">
25 + <xsl:value-of select="format-number(substring-before($datestr,'.'), '0' )" />
26 +</xsl:variable>
27 +{{/code}}
28 +
29 +are no longer possible. Instead, you can cache the result of the inner function in variables, for example:
30 +
31 +{{code language="xml"}}
32 +<xsl:variable name="ddtemp">
33 + <xsl:value-of select="substring-before($datestr,'.')" />
34 +</xsl:variable>
35 +
36 +<xsl:variable name="dd">
37 + <xsl:value-of select="format-number($ddtemp, '0' )" />
38 +</xsl:variable>
39 +{{/code}}
40 +
41 +=== Spaces ===
42 +
43 +Particularly when resolving loop variables, spaces are mandatory in certain constellations where this was not necessary before. This can be seen in the following example:
44 +
45 +{{code language="xml"}}
46 +<xsl:if test="position()=1 and .!=''">
47 +{{/code}}
48 +
49 +Spaces must be present here as follows:
50 +
51 +{{code language="xml"}}
52 +<xsl:if test="position() = 1 and . != ''">
53 +{{/code}}
54 +
55 +=== Functions in For-Each Loops ===
56 +
57 +The comparison of the //position()// variable e.g. within an xsl:if block could previously be done against a string with the position value.
58 +
59 +{{code language="xml"}}
60 +<xsl:if test="position()='1'">
61 +{{/code}}
62 +
63 +This never conformed to the standard, and is no longer possible. Instead, the comparison must be made with the pure numerical value:
64 +
65 +{{code language="xml"}}
66 +<xsl:if test="position() = 1">
67 +{{/code}}
68 +