I am trying to create such a structure
Code:
<be:part id="AAAAB">
<be:foretak>
<be:generelleopplysinger>
<be:navn>Ehsan Sadeghi</be:navn>
<be:adresse>
<be:postboks>111</be:postboks>
</be:adresse>
</be:generelleopplysinger>
</be:foretak>
<be:organisasjon />
</be:part>
from
Code:
<be:part id="AAAAB">
<be:foretak>
<be:navn>ehsansad</be:navn>
<be:adresse>
<be:postboks>111</be:postboks>
</be:adresse>
</be:foretak>
<be:organisasjon />
</be:part>
I have tried read the part and then apply templates for foretak , navn...., but this does not work so I had to create this ugly code
Code:
<xsl:template match="be:part">
<xsl:comment>part</xsl:comment>
<xsl:text>
</xsl:text>
<xsl:element name="be:part">
<xsl:attribute name="id">
<xsl:value-of select="@id"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="be:part/be:foretak">
<xsl:element name="be:foretak">
<xsl:element name="be:generelleopplysinger">
<xsl:element name="be:navn">
<xsl:apply-templates select="be:navn"/>
</xsl:element>
</xsl:element>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template name="be:navn">
<xsl:value-of select="."/>
</xsl:template>
1- if I use the full path in the <xsl:template name="be:navn"> such
<xsl:template name="be:part/be:foretak/be:navn">
I will get an error for the name which says it is not a correct QName, why don't understand.
2- why can't I just create each node in its own template as such
Code:
<xsl:template name="be:navn">
<xsl:element name="be:navn">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
if I do this the nodes will not be created and I will only get the value of the node.
why can't I get what I'm asking for?
cheers
es