Arabic number not shown properly - xslt

i am using FOP 2.4 to obtain a PDF document from a combination of XML and XSLT. everything is fine except number that need to be shown in farsi(arabic or hindi in MS Office) font. i am using this code to get number value of a block and format that:
<xsl:number value="rahgiri" format="أ" lang="fa"/>
the result is:
but needed result is:
any help is appreciated

Related

How to get ampersand "&" in output of Transform xml activity of TIBCO

Could anyone please help in getting the ampersand "&" output of Transform xml activity of TIBCO .
My requirement is the xmlstring from Transform xml activity is mapped to Parse xml (which will give the final output ) .Ex; Maitree&Sons. What should be passed in xslt so that when the output from Transform xml goes to Parse xml it will give the final result as "&".
I tried using CDATA and disable-escaping-output also in xslt but in parse xml it fails.
Please help.
Generally XSLT won't allow you to produce invalid output. The correct representation in XML is Maitree&Sons and this is what it produces. If it produced Maitree&Sons, this would be invalid XML and would be thrown out by an XML parser trying to read the document.
Having said that, it's possible using disable-output-escaping to produce an unescaped ampersand if your XSLT processor supports this option. If it's not working for you we need to know exactly what you did and how it failed.
(General rule: on SO, always tell us exactly what you did and exactly how it failed. Saying in general terms that you tried lots of things and none of them worked doesn't get us any nearer to a solution.)
LATER
I'm reading the question again. You want to produce output from the transformer that will go into an XML parser, such that the output of the parser is Maitree&Sons. Well, in that case the lexical XML must be Maitree&Sons, which it will be if you generate the string Maitree&Sons in XSLT. But XSLT is XML, so if you want to write this as a literal string in your stylesheet, it will be written Maitree&Sons.
I guess we need a much clearer picture of what you are doing and where it is going wrong.

How do I get the actual string from CDATA in XSL

Say I have a node tree:
<data>
<current-query-string><![CDATA[location=burnley]]></current-query-string>
</data>
How would I get the text only from inside the CDATA tags?
It's been a very long time since I wrote xslt at this level, and I cannot remember how to do it. I understand that CDATA is plain text, and how it all works, just not how to extract the actual string only.
Simply using:
link
is giving me:
link
I expect that result, I need to see the result:
link
How do I use the value as plain text?

Reading int and double numbers from xml file using MSXML in c++

I have a simple xml file which I need to read in c++. I am working on Windows so I choose MSXML. And it wouldn't be a problem if not for the way of how data is saved in the xml file. I cannot modify files as I have a lot of them + I can get a lot more in future. So the part that interest me the most in the xml file is:
<data>
<sample cost="2.000000000000000e+01">1</sample>
</data>
In the beginning of the xml I have specified a precision of the number and how much digits can be ignored.
So far by doing:
MSXML::IXMLDOMNodeListPtr temp = xmlDoc->selectNodes("data/*");
temp->Getitem(0)->Getxml();
gives me whole line as a string also:
temp->Getitem(0)->Gettext();
gives me a number between sections (in this case it is 1) but as a string. I dont know how to get access to a number in <> without manualy getting it from string returned by Getxml().
Getting this numbers manualy from string and converting them to double and int isnt a problem but I want to know if there is a way to directly get access to this numbers in double and int format.

XSLT output format

I am using XSLT to generate an .sql file from an .xml input file.
I have some problems with the indentation.
The way the stylesheet is formatted (how many line feeds and carriage returns and tabs) directly effects the output file i.e. if I include a few line feeds and CRs in my stylesheet to make it more readable, they are displayed in the output file as well (this would not be that bad if the tabs didn't affect the formatting of the output file as well):
It looks like this:
SQLStatement1<CR><LF>
<CR><LF>
<CR><LF>
SQLStatement2<CR><LF>
.... (tabs are also outputted)
I use an ant task to create the .sql file. The target looks like this:
<xslt in="input.xml"
out="queries.sql"
style="createQueries.xls">
</xslt>
I am using XSLT 1.0 and cannot use XSLT 2.0.
I thought about modifying some output parameters. However it does not have any effect if I change the method attribute to e.g. 'html' (I guess that the method is set to 'text' since the type of the output file(sql) is not known)
Any ideas on how to fix this issue?
Cheers
You would make it much easier on us if you showed a small but complete XML input sample, an XSLT sample, the output you get and the output you want.
If you use xsl:output method="text" and want to control the white space then make sure you use xsl:text to output literal text and xsl:value-of to output computed text. That way you should be able to control the white space exactly.

Detecting Characters in an XSLT

I have encountered some odd characters that do not display properly in Internet Explorer, such as these: “, –, and ’. I think they're carried over from copy-and-paste Word content.
I am using XSLT to build the page content and it would be great to detect these characters in the XSLT and replace them with valid HTML codes. I already do string replacement in the style sheet, but I'm not sure how detect these encoded characters or whether it's possible.
What about simply changing the encoding for the Stylesheet as well as its output to UTF-8? The characters you mention are “, – and ’. Certainly not invalid or so, given the correct encoding (the characters are at least perfectly valid in Codepage 1252).
Using a good XML editor such as XMLSpy should highlight any errors in formatting your XSLT by validating at development time.
Jeni Tennison's Multiple string replacements may be a good starting point.