bachie
bachie

Reputation: 25

Set the variables' value from XML using Altova Stylevision

I am creating an SPS file from Altova StyleVision. I want to get the values from an XML file to set the variables' value to be displayed in my PDF report.

Upvotes: 0

Views: 957

Answers (1)

Katrine B.
Katrine B.

Reputation: 126

In your SPS, it is possible to declare a variable which can contain the value of a selected element or attribute. Declare the variable on the relevant template, for example $Names, and then give it the path to the value like $XML/Personnel/Department/Managers/@Name

It will now contain the value of this path in your working xml file, and the same path but a different value if you use the sps with a different xml-file, or when you pass the generated xslt aother xml-file.

Working with variables is relatively easy, once you get the hang

The parameters work in a similar way, only they are static in the sps. You can give it a default value like "John" or "5", but not access xml-file data. But what you can do, is overwrite the value of the parameter when processing the xslt or sps through the command line in Altova XML or StyleVisionBatch. See this page in the manual: SPS Parameters for Sources

You can use XPath expressions here, and thus making the value of you parameter change with the value of the processed xml-file.

Upvotes: 1

Related Questions