Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - copying untagged information in an XML2XML transformation >Thread Next - Re: copying untagged information in an XML2XML transformation Re: copying untagged information in an XML2XML transformationTo: NULL Date: 10/16/2008 9:04:00 AM Your XML isn't well-formed so it's hard to test but the reason text isn't
coming through is that you select elements, with body/*, but not text nodes.
It looks like you should start with the identity template:
<!-- The Identity Transformation -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Whenever you match any node or any attribute -->
<xsl:template match="node()|@*">
<!-- Copy the current node -->
<xsl:copy>
<!-- Including any attributes it has and any child nodes -->
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- Additional templates here -->
</xsl:stylesheet>
then write any additional templates to process nodes as needed. For example
if you want all text to be bold then add:
<xsl:template match="text()">
<b><xsl:value-of select="." /></b>
</xsl:template>
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
"FMAS" <massion@g...> wrote in message
news:4e635d4d-9f63-4f06-81f5-77375d56539b@t......
>I have been struggling for months to find a way to transform an XML
> file without losing text which is not tagged. Here the simplified XML
> file and XSL file:
>
> XML file:
> ===============
> <?xml version='1.0'?>
> <body>
> </Tu>
> <Tu Origin="manual">
> <Tuv Lang="DE">Definition2 German.</Tuv>
> <Tuv Lang="PL">Definition2 translated.</Tuv>
> </Tu>
> <ut Style="external" DisplayText="SEC2">@Z_SEC2 = </ut>4.2
> <ut Style="external" DisplayText="Ebene 23">@Ebene 23 = </ut>
> <Tu Origin="manual">
> <Tuv Lang="DE">Definition3 German</Tuv>
> <Tuv Lang="PL">Definition3 translated</Tuv>
> </Tu>
> </body>
>
> XSL file:
> ===============
>
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0" >
> <xsl:template match="/">
> <xsl:for-each select="/body/*">
> <xsl:copy-of select="."/>
> </xsl:for-each>
> </xsl:template>
> </xsl:stylesheet>
>
> The transformed file has the <Tuv> and the <ut> texts but doesn't
> export text like "4.2" which is important but untagged information.
> Has anyone a clue?
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
