469,288 Members | 2,357 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,288 developers. It's quick & easy.

Outputing & on XML

5
I'm using XSLT to process an inbound xml file and wanted to translate all the ģ to ® but it's not allowing me to put in a & symbol. When I use ® it's outputing &reg. How can I get the output to format correctly?
Thanks.
Nov 23 '09 #1
9 3069
Dormilich
8,651 Expert Mod 8TB
either allow ® by writing it in the DTD or use its numeric entity.

PS. there are only 5 named entities defined by default in XML
Nov 23 '09 #2
flin2k
5
When I tried to write the ® to the output xml file with the following statement:
<xsl:with-param name="charsOut" select="'&reg;'"/>

oXygen complained that the entity "reg" was not declared. Then I try to change the "&" to &amp; as follow:
<xsl:with-param name="charsOut" select="'&amp;reg;'"/>
<xsl:with-param name="charsOut" select="'&reg;'"/> (I also try this but same result).

the output became CompanyName&amp;reg;


what I need is for the output xml to look like CompanyName&reg; How can I get this done?

Thanks.
Nov 23 '09 #3
Dormilich
8,651 Expert Mod 8TB
@flin2k
that is correct behaviour so far.

@flin2k
see post above.
Nov 23 '09 #4
flin2k
5
Is there a way to force the text "&reg;" to the outbound xml file?
Nov 24 '09 #5
Dormilich
8,651 Expert Mod 8TB
yes, and I have already told you, how to do it.
Nov 24 '09 #6
flin2k
5
I'm VERY new at this and don't understand what you mean by use its numeric entity or DTD? Any reference I can look up?
Thanks.
Nov 24 '09 #7
Dormilich
8,651 Expert Mod 8TB
letís try some keywords (in wikipedia)
named entity
numeric entity
DTD
XSD
XML
XML Specification
Nov 24 '09 #8
flin2k
5
If I read this correctly, I cannot use the "&" character directly so I'll need to use the predefined code "&amp;" thus when I coded the xsl as select="'&amp;reg;" shouldn't the translation from "&amp;" to "&" take place when output is generated? what am I missing?

Thanks.
Nov 24 '09 #9
Dormilich
8,651 Expert Mod 8TB
@flin2k
correct

@flin2k
not correct, there are 2 other ways to escape & (or ģ)*

@flin2k
nope, the substitution is done on screen (i.e. the representation changes), but the &amp; will remain as is in the source code.

@flin2k
link No. 2

* - compare what you see as this postís text with what you see in its source code
Nov 24 '09 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by bissatch | last post: by
reply views Thread by Thomas Scheffler | last post: by
reply views Thread by Paul Hatcher | last post: by
14 posts views Thread by Arne | last post: by
8 posts views Thread by Jon Slaughter | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.