Skip to main content
Solved

Using prefix in SUB-Template XMLTemplater


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>
View original
Did this help you find an answer to your question?

2 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • 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
  • January 11, 2019

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings