XML Functions Plugin - Macros - Create File¶
Contents :
- # CREATE FILE {output} FROM {input} BY APPLYIN XSLT {stylesheet}
- # CREATE FILE {output} FROM {input} BY APPLYIN XSLT {stylesheet} USING {xslt_config}
- # CREATE FILE {output} FROM XML RESOURCE {input} BY APPLYIN XSLT {stylesheet}
- # CREATE FILE {output} FROM XML RESOURCE {input} BY APPLYIN XSLT {stylesheet} USING {xslt_config}
# CREATE FILE {output} FROM {input} BY APPLYIN XSLT {stylesheet}¶
What ?
This macro applies a stylesheet to a xml file in order to create a file resource and logs the result in the console at DEBUG level.
Underlying instructions :
LOAD {input} AS __input{%%r1}.xml.file
CONVERT __input{%%r1}.xml.file TO xml(structured) AS __input{%%r1}.xml
LOAD {stylesheet} AS __stylesheet{%%r1}.xslt.file
CONVERT __stylesheet{%%r1}.xslt.file TO xml(structured) AS __stylesheet{%%r1}.xslt.xml
CONVERT __stylesheet{%%r1}.xslt.xml TO xslt AS __stylesheet{%%r1}.xslt
CONVERT __input{%%r1}.xml TO file(xslt) USING __stylesheet{%%r1}.xslt AS {output}
EXECUTE log WITH {output} USING $(logLevel: DEBUG,multiline: yes) AS $()
> Input :
{input}: The name of the file to convert (xmltype file).{stylesheet}: The name of the stylesheet file (xslttype file).
> Output :
{output}: The name of the converted resource (filetype resource).
Example :
# CREATE FILE sample-dataset-resource.xml FROM sample-dataset.xml BY APPLYIN XSLT table1n2sorted.xslt Resources :
![]()
SKF script :
![]()
Console output in DEBUG mode :
![]()
# CREATE FILE {output} FROM {input} BY APPLYIN XSLT {stylesheet} USING {xslt_config}¶
What ?
This macro applies a stylesheet and a config resource to a xml file in order to create a file resource and logs the result in the console at DEBUG level. Additional configurations can be done with a config file.
Underlying instructions :
LOAD {input} AS __input{%%r1}.xml.file
CONVERT __input{%%r1}.xml.file TO xml(structured) AS __input{%%r1}.xml
LOAD {stylesheet} AS __stylesheet{%%r1}.xslt.file
CONVERT __stylesheet{%%r1}.xslt.file TO xml(structured) AS __stylesheet{%%r1}.xslt.xml
CONVERT __stylesheet{%%r1}.xslt.xml TO xslt AS __stylesheet{%%r1}.xslt
CONVERT __input{%%r1}.xml TO file(xslt) USING __stylesheet{%%r1}.xslt,{xslt_config} AS {output}
EXECUTE log WITH {output} USING $(logLevel: DEBUG,multiline: yes) AS $()
> Input :
{input}: The name of the file to convert (xmltype file).{stylesheet}: The name of the stylesheet file (xslttype file).{xslt_config}: The name of the loaded configuration resource (filetype resource, from apropertiestype file). It can be used to normalize the output (normalize = true).
> Output :
{output}: The name of the converted resource (filetype resource).
Example :
# CREATE FILE sample-dataset-resource.xml FROM sample-dataset.xml BY APPLYIN XSLT table1n2sorted.xslt USING config-resource.file Resources :
![]()
SKF script :
![]()
Console output in DEBUG mode :
![]()
# CREATE FILE {output} FROM XML RESOURCE {input} BY APPLYIN XSLT {stylesheet}¶
What ?
This macro applies a stylesheet to a loaded xml resource in order to create a file resource and logs the result in the console at DEBUG level.
Underlying instructions :
LOAD {stylesheet} AS __stylesheet{%%r1}.xslt.file
CONVERT __stylesheet{%%r1}.xslt.file TO xml(structured) AS __stylesheet{%%r1}.xslt.xml
CONVERT __stylesheet{%%r1}.xslt.xml TO xslt AS __stylesheet{%%r1}.xslt
CONVERT {input} TO file(xslt) USING __stylesheet{%%r1}.xslt AS {output}
EXECUTE log WITH {output} USING $(logLevel: DEBUG,multiline: yes) AS $()
> Input :
{input}: The name of the loaded resource to convert (xmltype resource).{stylesheet}: The name of the stylesheet file (xslttype file).
> Output :
{output}: The name of the converted resource (filetype resource).
Example :
# CREATE FILE sample-dataset-resource-output.xml FROM XML RESOURCE sample-dataset-resource.xml BY APPLYIN XSLT table1n2sorted.xslt Resources :
![]()
SKF script :
In the SETUP phase, we load the sample-dataset.xml and replace all the occurrences of ‘${hello}’ by ‘Goodbye’ with a SUBSTITUTE KEYS macro. The resulting resource is then converted to a xml type resource and used in the CREATE FILE macro.
![]()
Console output in DEBUG mode :
![]()
# CREATE FILE {output} FROM XML RESOURCE {input} BY APPLYIN XSLT {stylesheet} USING {xslt_config}¶
What ?
This macro applies a stylesheet and a config resource to a loaded xml resource in order to create a file resource and logs the result in the console at DEBUG level. Additional configurations can be done with a config file.
Underlying instructions :
LOAD {stylesheet} AS __stylesheet{%%r1}.xslt.file
CONVERT __stylesheet{%%r1}.xslt.file TO xml(structured) AS __stylesheet{%%r1}.xslt.xml
CONVERT __stylesheet{%%r1}.xslt.xml TO xslt AS __stylesheet{%%r1}.xslt
CONVERT {input} TO file(xslt) USING __stylesheet{%%r1}.xslt,{xslt_config} AS {output}
EXECUTE log WITH {output} USING $(logLevel: DEBUG,multiline: yes) AS $()
> Input :
{input}: The name of the loaded resource to convert (xmltype resource).{stylesheet}: The name of the stylesheet resource (xslttype file).{xslt_config}: The name of the loaded configuration resource (filetype resource, from apropertiestype file). It can be used to normalize the output (normalize = true).
> Output :
{output}: The name of the converted resource (filetype resource).
Example :
# CREATE FILE sample-dataset-resource-output.xml FROM XML RESOURCE sample-dataset-resource.xml BY APPLYIN XSLT table1n2sorted.xslt USING config-resource.file Resources :
![]()
SKF script :
In the SETUP phase, we load the sample-dataset.xml and replace all the occurrences of ‘${hello}’ by ‘Goodbye’ with a SUBSTITUTE KEYS macro. The resulting resource is then converted to a xml type resource and used in the CREATE FILE macro.
![]()
Console output in DEBUG mode :
![]()