Skip to main content
Solved

Using prefix in SUB-Template XMLTemplater

  • January 11, 2019
  • 2 replies
  • 13 views

Hi,

I´m trying to create an XML-file from an excel sheet.

I have an xsd-file to create my header information in the ROOT-Template and it contains a number of prefix (namespace) definitions (not sure about the correct names here). When running the workspace it works fine using prefixes in the ROOT Template part but when using the same prefixes in the SUB template I get an error telling me it is not defined. Can I make the SUB Template recognize the definitions in the ROOT Template or can I somehow define them in the SUB Template but not writing it out in the _result attribute in the sub-part of the xml-file?

Best answer by takashi

Make sure to declare the namespace(s) (prefix)  in the SUB template expression. Something like this.

declare namespace xxx="http://the-namespace.com/xxx";
<xxx:tag>
...
</xxx:tag>

or

<xxx:tag xmlns:xxx="http://the-namespace.com/xxx">
...
</xxx:tag>
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

takashi
Celebrity
  • 7843 replies
  • Best Answer
  • January 11, 2019

Make sure to declare the namespace(s) (prefix)  in the SUB template expression. Something like this.

declare namespace xxx="http://the-namespace.com/xxx";
<xxx:tag>
...
</xxx:tag>

or

<xxx:tag xmlns:xxx="http://the-namespace.com/xxx">
...
</xxx:tag>

  • Author
  • 3 replies
  • January 11, 2019

Great! Thanks, declare... did the job!