Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Copy source to translation when type equals unfinished [Thread Next] Re: Copy source to translation when type equals unfinishedTo: NULL Date: 7/11/2008 5:18:00 AM Hi, Sorry, you're right, I meant the 'translation' element instead of 'target' element. Thanks a lot for the quick response. Works like a charm. Thomas On 11 jul, 13:41, Martin Honnen <mahotr...@yahoo.de> wrote: > 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> > > =A0<context> > > =A0 <name>ElementName</name> > > =A0 <message> > > =A0 =A0<location line=3D"16" filename=3D"build/debug/xslt/ > > xml_ApplicationDefaults.cpp" /> > > =A0 =A0<source>Application</source> > > =A0 =A0<translation>Programm</translation> > > =A0 </message> > > =A0 <message> > > =A0 =A0<location line=3D"24" filename=3D"build/debug/xslt/ > > xml_ElementsPaneLayout_PS.cpp" /> > > =A0 =A0<source>Archive hierarchy</source> > > =A0 =A0<translation type=3D"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 > =A0 =A0xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform" > =A0 =A0version=3D"1.0"> > > =A0 =A0<xsl:template match=3D"@* | node()"> > =A0 =A0 =A0<xsl:copy> > =A0 =A0 =A0 =A0<xsl:apply-templates select=3D"@* | node()"/> > =A0 =A0 =A0</xsl:copy> > =A0 =A0</xsl:template> > > =A0 =A0<xsl:template match=3D"message/translation[@type =3D 'unfinished']= "> > =A0 =A0 =A0<xsl:copy> > =A0 =A0 =A0 =A0<xsl:apply-templates select=3D"@*"/> > =A0 =A0 =A0 =A0<xsl:value-of select=3D"../source"/> > =A0 =A0 =A0</xsl:copy> > =A0 =A0</xsl:template> > > </xsl:stylesheet> > > -- > > =A0 =A0 =A0 =A0 Martin Honnen --- MVP XML > =A0 =A0 =A0 =A0http://JavaScript.FAQTs.com/- Tekst uit oorspronkelijk ber= icht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
