[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: For each child, create a new parent node incl
One more update. I think I have managed more or less in this version of the stylesheet: https://xsltfiddle.liberty-development.net/6rewNxx/8 It works in XSLTFiddle, but not when I run it in the command line with SaxonEE9-9-1-4J or saxon6-5-5, e.g. java -jar /mnt/c/Apps/saxon6-5-5/saxon.jar -o output_unmtuv.tmx input.tmx ~/path/to/unmerge_tuvs_xsl1.xsl or java -jar /mnt/c/Apps/Saxon9/SaxonEE9-9-1-4J/saxon9ee.jar -o:output_unmtuv.tmx input.tmx ~/path/to/unmerge_tuvs_xsl1.xsl Do you see any problem with it? CHeers, Manuel Manuel Souto Pico terminolator@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> escreveu no dia quarta, 28/08/2019 C (s) 13:03: > A quick update. > > I think I am closer in this version: > https://xsltfiddle.liberty-development.net/6rewNxx/4. The second problem > is fixed in it, the other two problems remain. > > I keep working on it, any tips are most welcome. > > Cheers, Manuel > > > > Manuel Souto Pico <terminolator@xxxxxxxxx> escreveu no dia quarta, > 28/08/2019 C (s) 12:52: > >> Dear all, >> >> What I am trying to do should be quite easy but I need some help. >> >> Here you can see the kind of input I have and my first attempt: >> https://xsltfiddle.liberty-development.net/6rewNxx >> >> So: >> >> - tu >> -- tuv en (1) >> -- tuv pt (1) >> -- tuv pt (2) >> -- tuv pt (n) >> >> In that input you can see that a tu node might have one source language >> tuv child and more than one target-language tuv children, such as the one >> with source text "Moving Around and Tracking Progress". >> >> The expect output is to have only one tuv child per tu node: >> >> - tu >> -- tuv en (1) >> -- tuv pt (1) >> >> - tu >> -- tuv en (1) >> -- tuv pt (2) >> >> - tu >> -- tuv en (1) >> -- tuv pt (1) >> >> Something like this: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <!DOCTYPE tmx SYSTEM " >> https://raw.githubusercontent.com/moiatgit/omegat/master/src/schemas/tmx14.dt d >> "> >> >> <tu> >> <tuv xml:lang="en-ZZ"> >> <seg>Moving Around and Tracking Progress</seg> >> </tuv> >> <tuv xml:lang="pt-BR"> >> <seg>MovimentaC'C#o e monitoramento de progresso</seg> >> </tuv> >> </tu> >> >> <tu> >> <tuv xml:lang="en-ZZ"> >> <seg>Moving Around and Tracking Progress</seg> >> </tuv> >> <tuv xml:lang="pt-BR"> >> <seg>Movendo-se e Monitorando o seu progresso</seg> >> </tuv> >> </tu> >> >> <tu> >> <tuv xml:lang="en-ZZ"> >> <seg>Moving Around and Tracking Progress</seg> >> </tuv> >> <tuv xml:lang="pt-BR"> >> <seg>Movendo-se e Monitorando seu progresso</seg> >> </tuv> >> </tu> >> >> In other words, unmerge the tu node, keeping always the same source text. >> >> My stylesheet is: >> >> <xsl:stylesheet version="1.0" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> >> <xsl:strip-space elements="*"/> >> >> <xsl:template match="body"> >> <xsl:copy> >> <xsl:for-each select='tu/tuv[@xml:lang="pt-BR"]'> >> <tu> >> <xsl:copy-of >> select='ancestor::tuv[@xml:lang="en-ZZ"]'/> >> <xsl:copy-of select="."/> >> </tu> >> </xsl:for-each> >> </xsl:copy> >> </xsl:template> >> >> </xsl:stylesheet> >> >> It has several problems: >> >> 1. The tmx root node is missing in my output >> 2. The source language (en-ZZ) does not appear in my output >> 3. It is specific for pt-BR, but the tag for the target language (i.e. >> for the multiple children) could be any -- the stylesheet should be generic >> (target-language agnostic). >> >> I don't have a preference about the XSLT version, I think there are >> non-commercial (free to use) Saxon processors for all three. >> >> Hopefully somebody can help me find solutions or point me in the right >> direction. Thanks in advance. >> >> Cheers, Manuel >> >> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2528023> (by > email <>)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|