W
Wendy Shuya
I am in the process of translating a large set of XML files. I've run
into some problems and thought someone may be able to assist.
Problem 1: Comments
-------------------
I need to match the comments (<!-- -->)in the original XML file, and
output them to the translated file. The code I have to do this:
<xsl:template match="comment()">
<xsl:comment><xsl:value-of select="."/></xsl:comment>
</xsl:template>
This template code seems to work fine if this is the "only" template
in my .xslt file. As soon as I add another template (for example):
<xsl:template match="/Project">
<xsl:apply-templates mode="copy" select="."/>
</xsl:template>
the comments are no longer printed. How can ensure that all comments
are going to be output?
Problem 2: DOCTYPE
------------------
The first few lines of original xml file includes something like:
<!DOCTYPE Project [
<!ENTITY common_device_type SYSTEM "CommonDeviceType.xml">
]>
I need to be able to conserve these lines of text and output them to
the translated file. Currently, I don't how to match on this text.
Secondly, further down in the file is a reference to this entity:
&common_device_type;
I don't want this entity to be expanded, but instead I want to just
keep the text output as original.
If anyone could offer any suggestions on how to do these things, it
would be much appreciated.
Thank you for your time,
Wendy Shuya
into some problems and thought someone may be able to assist.
Problem 1: Comments
-------------------
I need to match the comments (<!-- -->)in the original XML file, and
output them to the translated file. The code I have to do this:
<xsl:template match="comment()">
<xsl:comment><xsl:value-of select="."/></xsl:comment>
</xsl:template>
This template code seems to work fine if this is the "only" template
in my .xslt file. As soon as I add another template (for example):
<xsl:template match="/Project">
<xsl:apply-templates mode="copy" select="."/>
</xsl:template>
the comments are no longer printed. How can ensure that all comments
are going to be output?
Problem 2: DOCTYPE
------------------
The first few lines of original xml file includes something like:
<!DOCTYPE Project [
<!ENTITY common_device_type SYSTEM "CommonDeviceType.xml">
]>
I need to be able to conserve these lines of text and output them to
the translated file. Currently, I don't how to match on this text.
Secondly, further down in the file is a reference to this entity:
&common_device_type;
I don't want this entity to be expanded, but instead I want to just
keep the text output as original.
If anyone could offer any suggestions on how to do these things, it
would be much appreciated.
Thank you for your time,
Wendy Shuya