|
Subject: [xsl] Copying all comments [xsltproc 1.0] From: pankaj.c@xxxxxxxxxxxxxxxxxx Date: Mon, 4 Oct 2010 17:05:03 +0530 |
Input:
====
<!--<query id="Q26">ED: È stata cambiata valutazione in
accertamento perché in altri capitoli viene citato
l’accertamento come prima fase del processo di assistenza
infermiersitica. Ok?</query>-->
Output
====
<query id="Q26">ED: &#x00C8; stata cambiata valutazione in
accertamento perch&#x00E9; in altri capitoli viene citato
l&#x2019;accertamento come prima fase del processo di assistenza
infermiersitica. Ok?</query>
Desired output:
========
<query id="Q26">ED: È stata cambiata valutazione in accertamento
perché in altri capitoli viene citato l’accertamento come
prima fase del processo di assistenza infermiersitica. Ok?</query>
Tried XSLT:
=======
<xsl:for-each select="//comment()">
<xsl:choose>
<xsl:when test="substring(.,2,8)='query id'">
<xsl:text>
</xsl:text>
<xsl:value-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
I even tried different manipulation (substring(), substring-after() etc)to
get this done, for instance below one.
<xsl:for-each select="//comment()">
<xsl:choose>
<xsl:when test="substring(.,2,8)='query id'">
<xsl:text>
</xsl:text>
<xsl:element name="query">
<xsl:value-of select="."/>
</xsl:element>
<xsl:value-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
Just to add, notice È changing to &#x00C8; and similarly >
< (thats what xsl:value-of does. :-( ). Would have been much easier
with 2.0 with the use of
<xsl:sequence
select="replace(codepoints-to-string(string-to-codepoints($arg)),
'\[#x([0-9A-Za-z]+)\]', '#x$1;')"/> and replace() function.
and so on,
but alas I am using 1.0. Is there a way to get this done in 1.0?
Thanks for hints.
Pankaj
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Modifying a DTD with XSLT, dvint | Thread | Re: [xsl] Copying all comments [xsl, David Carlisle |
| Re: [xsl] Modifying a DTD with XSLT, David Carlisle | Date | Re: [xsl] Copying all comments [xsl, David Carlisle |
| Month |