OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

xliff-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: [xliff-comment] Including XHTML with XLIFF


I would like to include XHTML tags in the XLIFF document and still be able
to validate and transform the XLIFF document. I don't want to require the
translator to include the xhtml: (or html:) namespace when entering XHTML
tags. It seems more natural to have to specify XLIFF tags (like <ph>) with
the xlf: namespace rather than the more familiar HTML tags.

Therefore I believe I need to make XHTML the default namespace and
explicitly set the XLIFF namespace.

Example XLIFF document,

<?xml version="1.0" encoding="UTF-8"?>
<xlf:xliff version="1.1" xmlns:xlf="urn:oasis:names:tc:xliff:document:1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.1 xliff.xsd"
xmlns="xhtml">
	<xlf:file original="" source-language="EN" target-language="ES"
datatype="html">
		<xlf:body>
			<xlf:trans-unit id="hw" datatype="html">
				<xlf:source>
					<i class="greeting">Hello</i> <xlf:ph id="w">World</xlf:ph>
				</xlf:source>
				<xlf:target>
					<i class="greeting">Hola</i> <xlf:ph id="w">Mundo</xlf:ph>
				</xlf:target>
			</xlf:trans-unit>
		</xlf:body>
	</xlf:file>
</xlf:xliff>

This document validates without a problem.

The problem comes with the XSLT. The namespace attributes are in the output.

Example XSLT, (note that the XLIFF tags MUST be prefixed with "xlf:")
This XSLT copies the contents for the <target> tag, which may include HTML
tags and converts <xlf:ph> to a hyperlink (<a href>).

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xlf="urn:oasis:names:tc:xliff:document:1.1">
	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>

	<xsl:template match="/">
			<xsl:apply-templates select="//xlf:target"/>
	</xsl:template>

	<xsl:template match="xlf:*">
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="xlf:ph">
		<a href="www.xliff.org"><xsl:apply-templates /></a>
	</xsl:template>

	<xsl:template match="*">
		<xsl:copy>
			<xsl:apply-templates select="@*" />
			<xsl:apply-templates />
		</xsl:copy>
	</xsl:template>

	<xsl:template match="@*">
		<xsl:copy-of select="."/>
	</xsl:template>

</xsl:stylesheet>

Example results,

<i class="greeting" xmlns:xlf="urn:oasis:names:tc:xliff:document:1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns="xhtml">Hola</i>
<a href="www.xliff.org"
xmlns:xlf="urn:oasis:names:tc:xliff:document:1.1">Mundo</a>

As you can see, the results have 'xmlns:xlf', 'xmlns:xsi', and 'xmlns'
attributes in EVERY tag.


Is there some way to suppress the xml attributes?

Are there working examples of mixing HTML with XLIFF?


FYI, I'm using XMLSpy 4.4 to validate and the Microsoft XSLT engine
(msxsl.exe).


Regards,

Doug D

Ektron, Inc.
+1 603 594-0249
http://www.ektron.com



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC