Hallo Zusammen,
ich habe diese xml-Datei:
<?xml version="1.0" encoding="UTF-8"?>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table1</s>
<t state="new">tabelle1</t>
<comment priority="1">Comment1</comment>
</b>
<b id="a4" >
<s>Table2</s>
<t state="new">tabelle2</t>
<comment priority="1">Comment2</comment><special-comment>xy Comment2</special-comment>
</b>
</body>
</a>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table3</s>
<t state="new">tabelle3</t>
<special-comment priority="1">Comment4</special-comment>
</b>
<b id="a4" >
<s>Table4</s>
<t xml:lang="de-DE" state="new">tabelle4</t>
<comment priority="1">Comment6</comment><special-comment>RDComment4</special-comment>
</b>
</body>
</a>
</xliff>
und ich muss die so konvertiern:
<?xml version="1.0" encoding="UTF-8"?>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table1</s>
<t state="new">tabelle1</t>
<special-comment priority="1">Comment1</special-comment>
</b>
<b id="a4" >
<s>Table2</s>
<t state="new">tabelle2</t>
<special-comment priority="1">Comment2, xy Comment2</special-comment>
</b>
</body>
</a>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table3</s>
<t state="new">tabelle3</t>
<special-comment priority="1">Comment4</special-comment>
</b>
<b id="a4" >
<s>Table4</s>
<t xml:lang="de-DE" state="new">tabelle4</t>
<special-comment priority="1">Comment6, RDComment4</special-comment>
</b>
</body>
</a>
kann jemand mir dabei helfen? Ich bekomme mit meine XSLT-Datei sowas:
<?xml version="1.0" encoding="UTF-8"?>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table1</s>
<t state="new">tabelle1</t>
<special-comment priority="1">Comment1</special-comment>
</b>
<b id="a4" >
<s>Table2</s>
<t state="new">tabelle2</t>
<special-comment priority="1">Comment2</special-comment><special-comment>xy Comment2</special-comment>
</b>
</body>
</a>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table3</s>
<t state="new">tabelle3</t>
<special-comment priority="1">Comment4</special-comment>
</b>
<b id="a4" >
<s>Table4</s>
<t xml:lang="de-DE" state="new">tabelle4</t>
<special-comment priority="1">Comment6</special-comment><special-comment>RDComment4</special-comment>
</b>
</body>
</a>
und natürlich die XSLT-Datei sieht so aus:
<xslt:transform version="1.0"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<xslt:key name="com" match="trans-unit" use="comment"/>
<xslt:template match="@* | node()">
<xslt:copy>
<xslt:apply-templates select="@*"/>
<xslt:apply-templates/>
</xslt:copy>
</xslt:template>
<xslt:template match="a">
<xslt:copy>
<xslt:apply-templates select="@*"/>
<xslt:apply-templates/>
<xslt:apply-templates select="key('com',
count(preceding-sibling::a) + 1)/comment"/>
</xslt:copy>
</xslt:template>
<xslt:template match="comment">
<special-comment>
<xslt:apply-templates select="@*"/>
<xslt:apply-templates/>
</special-comment>
</xslt:template>
</xslt:transform>
Ich freue mich über jede Hinweis.
Maria
ich habe diese xml-Datei:
<?xml version="1.0" encoding="UTF-8"?>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table1</s>
<t state="new">tabelle1</t>
<comment priority="1">Comment1</comment>
</b>
<b id="a4" >
<s>Table2</s>
<t state="new">tabelle2</t>
<comment priority="1">Comment2</comment><special-comment>xy Comment2</special-comment>
</b>
</body>
</a>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table3</s>
<t state="new">tabelle3</t>
<special-comment priority="1">Comment4</special-comment>
</b>
<b id="a4" >
<s>Table4</s>
<t xml:lang="de-DE" state="new">tabelle4</t>
<comment priority="1">Comment6</comment><special-comment>RDComment4</special-comment>
</b>
</body>
</a>
</xliff>
und ich muss die so konvertiern:
<?xml version="1.0" encoding="UTF-8"?>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table1</s>
<t state="new">tabelle1</t>
<special-comment priority="1">Comment1</special-comment>
</b>
<b id="a4" >
<s>Table2</s>
<t state="new">tabelle2</t>
<special-comment priority="1">Comment2, xy Comment2</special-comment>
</b>
</body>
</a>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table3</s>
<t state="new">tabelle3</t>
<special-comment priority="1">Comment4</special-comment>
</b>
<b id="a4" >
<s>Table4</s>
<t xml:lang="de-DE" state="new">tabelle4</t>
<special-comment priority="1">Comment6, RDComment4</special-comment>
</b>
</body>
</a>
kann jemand mir dabei helfen? Ich bekomme mit meine XSLT-Datei sowas:
<?xml version="1.0" encoding="UTF-8"?>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table1</s>
<t state="new">tabelle1</t>
<special-comment priority="1">Comment1</special-comment>
</b>
<b id="a4" >
<s>Table2</s>
<t state="new">tabelle2</t>
<special-comment priority="1">Comment2</special-comment><special-comment>xy Comment2</special-comment>
</b>
</body>
</a>
<a>
<header><skl><external-file href="skeleton.skl"/></skl></header>
<body>
<b id="a3" >
<s>Table3</s>
<t state="new">tabelle3</t>
<special-comment priority="1">Comment4</special-comment>
</b>
<b id="a4" >
<s>Table4</s>
<t xml:lang="de-DE" state="new">tabelle4</t>
<special-comment priority="1">Comment6</special-comment><special-comment>RDComment4</special-comment>
</b>
</body>
</a>
und natürlich die XSLT-Datei sieht so aus:
<xslt:transform version="1.0"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<xslt:key name="com" match="trans-unit" use="comment"/>
<xslt:template match="@* | node()">
<xslt:copy>
<xslt:apply-templates select="@*"/>
<xslt:apply-templates/>
</xslt:copy>
</xslt:template>
<xslt:template match="a">
<xslt:copy>
<xslt:apply-templates select="@*"/>
<xslt:apply-templates/>
<xslt:apply-templates select="key('com',
count(preceding-sibling::a) + 1)/comment"/>
</xslt:copy>
</xslt:template>
<xslt:template match="comment">
<special-comment>
<xslt:apply-templates select="@*"/>
<xslt:apply-templates/>
</special-comment>
</xslt:template>
</xslt:transform>
Ich freue mich über jede Hinweis.
Maria
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von m.d ()