Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old June 26th, 2006, 05:42 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
Default 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
 
Old June 26th, 2006, 05:47 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old June 26th, 2006, 07:17 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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.


 
Old June 26th, 2006, 07:34 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old June 27th, 2006, 05:42 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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.


 
Old June 27th, 2006, 06:22 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old June 27th, 2006, 06:34 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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.



 
Old June 27th, 2006, 07:15 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old June 27th, 2006, 08:00 AM
Authorized User
 
Join Date: Jun 2006
Posts: 16
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Dear Michael,

Thanks for your valuable guidance. But it generates as &x3b1; instead #x003B1;

Any help would greatful.

Thanks,
RICHBIRD.


 
Old June 27th, 2006, 08:16 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hexadecimal Addition madanshah16 XSLT 1 July 31st, 2007 07:21 AM
help syntax please khautinh SQL Server 2000 1 August 26th, 2006 02:47 AM
c# syntax msrnivas .NET Web Services 2 October 15th, 2004 01:26 AM
Incorrect syntax near '`' Hez Classic ASP Databases 3 August 5th, 2004 08:13 AM
Hexadecimal numbers in MS SQL Server 7 notChavez SQL Server 2000 3 June 19th, 2003 08:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.