 |
| XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 26th, 2006, 05:42 AM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Syntax for Hexadecimal NCRs ?
Hi All,
I am using XSLT 2.0, following is the syntax used to generate Decimal NCRs:
<xsl:output method="xml" encoding="iso-8859-1" omit-xml-declaration="yes" />
what would be the syntax to generate Hexadecimal NCRs: ??
Any help would be great full
Thanks,
RICHBIRD.
__________________
Thanks,
Richbird
|
|

June 26th, 2006, 05:47 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
I guess NCR = numeric character reference?
XSLT doesn't define whether output character references should be decimal or hexadecimal, and doesn't allow you to choose. But Saxon has a switch to control this, saxon:character-representation.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

June 26th, 2006, 07:17 AM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Dear Michael,
Thanks for your valuable sytnax, since following syntax results the same decimal output.
<xsl:output method="xml" encoding="iso-8859-1"
saxon:character-representation="native;hex"/>
Input
ñ
current output
#945;
required output
#x003B1;
Any help would be great full
Thanks,
RICHBIRD.
|
|

June 26th, 2006, 07:34 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
The format native;hex applies to method="html" only
http://www.saxonica.com/documentatio...sentation.html
For method="xml", just use saxon:character-representation="hex"
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

June 27th, 2006, 05:42 AM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Dear Michael,
Following is the used code .....
<xsl:output method="xml" encoding="iso-8859-1" saxon:character-representation="hex"/>
Since it result the decimal NCRs.
Help needed.
Thanks,
RICHBIRD.
|
|

June 27th, 2006, 06:22 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Perhaps you declared the saxon namespace incorrectly?
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

June 27th, 2006, 06:34 AM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Dear Michael,
Following is the used namespace .....
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns:o="urn:schemas-microsoft-com:office:office"
exclude-result-prefixes="aml w wx o v"
xmlns:saxon="http://icl.com/saxon"
extension-element-prefixes="saxon" >
Waiting eagerly
Thanks,
RICHBIRD.
|
|

June 27th, 2006, 07:15 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
For Saxon 8.x (and indeed 7.x) the correct namespace is "http://saxon.sf.net/"
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

June 27th, 2006, 08:00 AM
|
|
Authorized User
|
|
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Dear Michael,
Thanks for your valuable guidance. But it generates as &x3b1; instead #x003B1;
Any help would greatful.
Thanks,
RICHBIRD.
|
|

June 27th, 2006, 08:16 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Sorry, at that point you're out of luck.
You never explained why you are trying to get such detailed control of the output. Is the consumer of these documents really so poorly-designed that it requires exactly 5 (!) hexadecimal digits?
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
 |