473,691 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

&lt; to < with XSLT

Hi to all,

I have a xml file, a substring like:

&lt;a href=&quot;#&qu ot;&gt;text&lt;/a&gt;

which after an xslt trasform is rendered as (using xsl:output method html):

&lt;a href="#"&gt;tex t&lt;/a&gt;
How can I get as xslt result the following:

<a href="#">text</a>

I cannot use CDATA for indexing problem of the original text...

thank you for any suggestion
Jul 20 '05 #1
4 9642

If your processor supports d-o-e then you can use

<xsl:value-of disable-output-escaping="yes" select="."/>

assuming the current node is the element containing your quoted string.

Jul 20 '05 #2
Hi David,
thankes for your answer, but it' not possible for me because if I have
an other &lt; it must be no converted... example:

text 3&lt;4 is true as shown in the following url:
&lt;a href=&quot;#&qu ot;&gt;text&lt;/a&gt;

in which the first "&lt;" must be not converted before it arrives to the
browser, others they do...

David Carlisle ha scritto:
If your processor supports d-o-e then you can use

<xsl:value-of disable-output-escaping="yes" select="."/>

assuming the current node is the element containing your quoted string.


Jul 20 '05 #3


If possible I'd suggest not starting from there, your input is basically
broken, but if you have no control over the input then basically what
you need to do is decide on some heuristics that some piece of text
"looks like" HTML markup and so output it unquoted.

I really wouldn't use XSLT 1 for that, you want something with regexp
support, perl or XSLT2 draft (as implemented in saxon 8) or if you are
using xslt1 I'd look into whether your processor allows extension to
some language with regexp (javascript or java perhaps) just to handle
that text string.

In simple cases you could use
<xsl:value-of select="substri ng-before('.&lt;a href=&quot;')/>
<a href="{substrin g-before(substrin g-after('.&lt;a href'),'&quot;' )}">

etc etc with lots of substring before and after, but it gets very hard
to manage such code.

Jul 20 '05 #4
In article <cl**********@l acerta.tiscalin et.it>,
matatu <ma****@katamai l.com> wrote:
thankes for your answer, but it' not possible for me because if I have
an other &lt; it must be no converted... example:

Well, how do you expect XSLT to know which should be converted? Only
you know that! You will have to make your stylesheet disable output
escaping for the ones that need to be converted, and not for the

It may well be that XSLT is not the best tool for this; a generic
stream editor like sed might be better. Or perhaps you should
reconsider how your data is generated in the first place, so that it
doesn't have markup represented in the same way as ordinary text.

-- Richard
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Paminu | last post by:
In math this expression: (a < b) && (b < c) would be described as: a < b < c But why is it that in C these two expressions evaluate to something different for the same values of a, b and c?
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an XSLT and replace all occurances of &lt; with < and &gt; with >.
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.