Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Testing for special characters

From: "Graeme Kidd" <coolkidd3@----------->
To:
Date: 1/2/2009 4:03:00 PM
The problem has nothing to do with special characters (At least I assume 
so:

it's possible that the character in question is not really "." at all, but

some other character that has not made it through to the email).
Well using this website:

http://www.pinyin.info/tools/converter/chars2uninumbers.html

It tells me that the dot you see is a "&#8226;" in "decimal (not hex) form 
of Unicode numerical character references (NCRs)".  If you go to Google and 
search for that code it will return the character.



When I used that in the test:
<xsl:template match="P">
   <xsl:if test=".='&#8226; '">
       <xsl:value-of select="current()" />
   </xsl:if>
</xsl:template>

It picks up the bullet points no problem. I am still having difficulty 
selecting the previous node. So far I have thisL

<xsl:value-of select="preceding-sibling::Child[1]" />

But it doesn't work.



Any ideas what I am doing wrong.
Thanks,
Graeme

--------------------------------------------------
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Sent: Friday, January 02, 2009 3:03 PM
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: [xsl] Testing for special characters

Your test:



<xsl:if test="P='. '">



tests whether any child::P of the context node is equal to ". ". This 
isn't

very useful if you are positioned on the <Sect> element, and it isn't at 
all

useful if you are positioned on the "P" element. The most likely 
explanation

is that you are using this test "in the wrong place".



The problem has nothing to do with special characters (At least I assume 
so:

it's possible that the character in question is not really "." at all, but

some other character that has not made it through to the email).



It's hard to propose a solution without seeing a wider selection of the
possible inputs that need to be processed.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Graeme Kidd [mailto:coolkidd3@xxxxxxxxxxx]
Sent: 02 January 2009 14:36
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Testing for special characters

Hi,
I have used  Adobe Acrobat to export a PDF as XML and I am
wanting to convert it.
Sometime it displays an unordered list like this:

<Sect>
    <P>List: </P>
    <P>Item 1; </P>
    <P>. </P>
    <P>Item 2; </P>
    <P>. </P>
    <P>Item 3; </P>
    <P>. </P>
</Sect>

Which I am trying to convert to this:



<Sect>
    <P>List:</P>
    <UL>
        <LI>Item 1; </LI>
        <LI>Item 2; </LI>
        <LI>Item 3; </LI>
    </UL>
</Sect>

The best I can think of is to check if there is a bullet
point then use the previous <P> node.  At the moment I am
having trouble just checking if there is a bullet point as
this doesn't seem to work:
<xsl:if test="P='. '">

I am thinking it might be because it is a special character.
I have tried specifying the output as UTF-8 <xsl:output
method="xml" indent="yes" encoding="UTF-8" />

But that didn't seem to help, so does anyone else have any ideas?
Thanks


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent