RE: p:store serialization "character-map like"

If you are only talking about numeric entities, you could perhaps use the
codepoints functions to convert number to unicode char. Otherwise, I would
think about trying to do an eval on your string. Sure Saxon has an eval
function either in XSLT or in XQuery. You could also eval on XProc I
thought, but maybe that overcomplicates things more than you want..



Sounds like character mapping could be a useful addition to XProc vNext?



Cheers



*Van:* RICAUD-DUSSARGET Matthieu [mailto:matthieu.ricaud@igs-cp.fr]
*Verzonden:* maandag 20 januari 2014 11:10
*Aan:* XProc Dev
*Onderwerp:* Re: p:store serialization "character-map like"



Oups not Levex but "Lexev" by Andrew Welch (http://andrewjwelch.com/lexev/)
!



I've tried : <xsl:value-of select="concat('&amp;',$entity.name,';')"
disable-output-escaping="yes"/>

where $entity.name is "160"



But I still get "&amp;160;"

It seems  disable-output-escaping="yes" doesn't work when running an
<p:xslt> as seen on http://markmail.org/message/3wig52gf3xkwwsdc



So I think I will let this away and give an error message in case of
character map with such escape entity "&amp;{entité};".



Regards









2014/1/20 RICAUD-DUSSARGET Matthieu <matthieu.ricaud@igs-cp.fr>

Hi all,



Character-map is not allowed as an option of p:store (
http://www.w3.org/TR/2010/REC-xproc-20100511/#serialization-options), I
don't really understand why and we really need this in our process, so I'm
trying to define a declare-step that does the trick (for
xsl:result-document at least) :



1. tranform a bit the xslt by :

    - adding the @format to the @href of any xsl:result-document (I will
then be able to get the @format from p:base-uri())

    - adding an identity template that output the xsl:output and
xsl:character-maps



2. Reading this secondary output so I can pass dynamicly the serialization
options (xsl:ouptut) to the p:store



3. Adding an xslt step that read the corresponding xsl:character-maps in
the secondary output to operate a regex replacement of the matchings
characters.



Well this is a try, any suggests on this is welcome.



For the moment the only thing I'm not abale to do is to deal with this kind
of character map :



<xsl:output-character character="&#8201;" string="&amp;#160;"/> <!-- THIN
SPACE replace by NO-BREAK SPACE -->



Using saxon out of xproc this character map rule will replace any thin
space "&#8201;" by a no break space "&#160;", but when trying to replace it
with a regex (in xslt, see the process above) I get "&amp;160;" in the
output.



Of course I could directly write the good entity :

<xsl:output-character character="&#8201;" string="&#160;"/>

and this would work fine.

But the goal here is to really implement character-map mechanism.

By the way outputing &#160; can make it easier to read the output file and
see no break spaces.



I think this is not possible "construct" dynamicly an entity with xslt or
maybe by using specials saxon function ? but I don't manage to, for
instance :

with xproc/calabash, <saxon:entity-ref name="160"
xsl:extension-element-prefixes="saxon"/> also output "&amp;160;" and not
the desired "&160;"





I'll have a look at levex, but any suggest is welcome.



Regards,

Matthieu



-- 

Matthieu Ricaud-Dussarget

IGS-CP - Développeur XML

05 45 37 09 49





-- 

Matthieu Ricaud-Dussarget

IGS-CP - Développeur XML

05 45 37 09 49

Received on Tuesday, 21 January 2014 08:03:27 UTC