Huditsch Roman wrote:
> I am still stuck with the problem, that I can't use elementTemplates
> properly.
> All I get is a selected Element, but the strucutre defined in my
> elementTemplate doesn't get inserted
> after it.
> I am able to insert the strucutre by hand, so there should be no
> validation issue.
Good idea to check this.
> Here is my code:
>
> <cfg:command name="docb.addAfter">
> <cfg:macro>
> <cfg:sequence>
> <cfg:command name="selectNode"
> parameter="ancestorOrSelf[implicitElement]
> {http://www.lexisnexis.at/schema/norm}absatz
> {http://www.lexisnexis.at/schema/norm}zaehlung
> {http://www.lexisnexis.at/schema/norm}liste
> {http://www.lexisnexis.at/schema/norm}tabelle"/>
> <cfg:command name="insert" parameter="after[implicitElement]
> #template(*,simple)"/>
> </cfg:sequence>
> </cfg:macro>
> </cfg:command>
Replace:
---
#template(*,simple)
---
by:
---
#template({http://www.lexisnexis.at/schema/norm}table,simple)
---
The syntax is #template(fully_qualified_element_name_using_{}_notation,
template_name).
Most errors come from the fact that the element in the corresponding
elementTemplate is not defined in the right namespace.
> <cfg:elementTemplate xmlns="http://www.lexisnexis.at/schema/norm"
> name="simple" selectable="override">
> <table frame="none">
> <tgroup cols="2">
> <colspec colname="col1" colnum="1" colsep="0" colwidth="0.7*"
> rowsep="0"/>
> <colspec colname="col2" colnum="2" colsep="0" colwidth="4.7*"
> rowsep="0"/>
> <tbody>
> <row>
> <entry/>
> <entry/>
> </row>
> <row>
> <entry/>
> <entry/>
> </row>
> </tbody>
> </tgroup>
> </table>
> </cfg:elementTemplate>
Seems OK.
[Optional] Unless you want to make the above table your *default* table,
replace:
---
selectable="override"
---
by:
---
selectable="false"
---
or by:
---
selectable="true"
---
> I tried nearly every possible combination. I also defined my namespace
> directly in the table element (which seems more correct to me),
Should work fine too.
> but after reading the examples in the documentation, I decided to try it
> this way.