Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Named entity ref to hex code (using char mapping)

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an XML which contains named entity references like — etc.

I am using an XSLT to transform this XML to another XML. This XSLT also uses character mapping (I am using Saxon 8b for XSLT 2.0).

There is another XSLT called charmap.xsl which is imported in the original XSLT

charmap.xsl looks like this


The main XSLT looks like this



What I can't understand is that even after the XML is transformed I still get named entity references in the transformed XML.
I was expecting hex code values there (because of the charmap). Please tell me how to get the hex code values in the transformed XML rather than the named entity refernces whcih are there in the original XML.

Thank You
 
Marshal
Posts: 25965
70
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First make sure you are really using Saxon, and not an XSLT 1.0 transformer, to do your transformation. Then fix the inconsistency here:

... encoding="ISO-8859-1" omit-xml-declaration="yes"

If you omit the XML declaration, then the output encoding must be one of the XML defaults, namely UTF-8 or UTF-16. I doubt that is the problem but anything is possible.
 
sangeeta kapoor
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for replying but that didn't help
 
Paul Clapham
Marshal
Posts: 25965
70
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I realize I don't understand your terminology. You provide a character map that looks to me like it tells Saxon to output what I would call "named entity references" for certain characters. But then you say you would expect "hex code values" because of the character map.

Let's take your ellipsis character for example. I would expect the output to be "…" because that's what the character map specifies. That's a named entity reference, isn't it? Are you saying that despite the character map, you would still expect to see "…" in the output?

I would say, if that's what you want then just leave the character map out entirely.
 
If you're gonna buy things, buy this thing and I get a fat kickback:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic