Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Copy source to translation when type equals unfinished >Thread Next - Re: Copy source to translation when type equals unfinished Re: Copy source to translation when type equals unfinishedTo: NULL Date: 7/11/2008 1:42:00 PM
Thomas wrote:
> To process this file in our translation environment I would need an
> XSL transformation that copies this file with the following change:
> whenever the attribute type of the element translation equals
> unfinished, I want the content of the element source copied to the
> element target.
>
>
> So the desired output would look like this:
>
>
> <TS>
> <context>
> <name>ElementName</name>
> <message>
> <location line="16" filename="build/debug/xslt/
> xml_ApplicationDefaults.cpp" />
> <source>Application</source>
> <translation>Programm</translation>
> </message>
> <message>
> <location line="24" filename="build/debug/xslt/
> xml_ElementsPaneLayout_PS.cpp" />
> <source>Archive hierarchy</source>
> <translation type="unfinished">Archive hierarchy</translation>
I don't see any element named 'target' in the output, rather the
contents of the 'source' element is copied to the 'translation' element.
The following stylesheet does that:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="message/translation[@type = 'unfinished']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:value-of select="../source"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
