I have source html sth like this:
<td id="All_Label_Subcategories">
<source>
All Label Subcategories
</source>
<target>
target empty
</target>
</td>
<td id='node_without_child_nodes'>
some text
</td>
Expected target xml:
<trans-unit id="td-1">
<source>All Label Subcategories</source>
<target>target empty</target>
</trans-unit>
<trans-unit id="td-2">
<source>some text</source>
<target>some text</target>
</trans-unit>
I am using xslt from xliffRoundTrip Tool , I am not sure I should past the whole xlst here , it opensource though . Part of the xslt that is responsible for this conversion and needs to modify is :
<xsl:choose>
<xsl:when test="not(text())">
<group xmlns="urn:oasis:names:tc:xliff:document:1.2" id="{concat(generate-id(),'axmark',local-name(),'-',(count(preceding::*)+count(ancestor::*)))}">
<xsl:apply-templates />
</group>
</xsl:when>
<xsl:otherwise>
<group xmlns="urn:oasis:names:tc:xliff:document:1.2" id="{concat(generate-id(),'axmark',local-name(),'-',(count(preceding::*)+count(ancestor::*)))}">
<trans-unit id="{concat(local-name(),'-',(count(preceding::*)+count(ancestor::*)))}">
<source>
<xsl:apply-templates />
</source>
<target>
<xsl:apply-templates />
</target>
</trans-unit>
</group>
</xsl:otherwise>
</xsl:choose>
My intention is to pass custom data for target language , as on many occasions we need to revise target language and pass the target string for revision.
Edits I modified the xslt it but it copies twice e. g
<xsl:choose>
<xsl:when test="not(text()) and not(*[source and target]) ">
<xsl:choose>
<xsl:when test="*[source and target]">
<trans-unit id="{concat(local-name(),'-',(count(preceding::*)+count(ancestor::*)))}">
<source match="source">
<xsl:apply-templates />
</source>
<target match="target">
<xsl:apply-templates />
</target>
</trans-unit>
</xsl:when>
<xsl:otherwise>
<group xmlns="urn:oasis:names:tc:xliff:document:1.2" id="{concat(generate-id(),'axmark',local-name(),'-',(count(preceding::*)+count(ancestor::*)))}">
<xsl:apply-templates />
</group>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<group xmlns="urn:oasis:names:tc:xliff:document:1.2" id="{concat(generate-id(),'axmark',local-name(),'-',(count(preceding::*)+count(ancestor::*)))}">
<trans-unit id="{concat(local-name(),'-',(count(preceding::*)+count(ancestor::*)))}">
<source>
<xsl:apply-templates />
</source>
<target>
<xsl:apply-templates />
</target>
</trans-unit>
</group>
</xsl:otherwise>
</xsl:choose>