473,569 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT:Preserving HTML tags from original XML.

Joe
How would you preserve tags from an XML element in XSLT output..

Example:

XML document has an ELEMENT "SECTION" allowing contained HTML

This element might have an element such as <A HREF="dfksdfaj" >go</A>

I want the output from XSLT processing of the SECTION elements to
output
"<A HREF="dfksdfaj" >go</A>" and not "go". I've tried <xsl:value-of
disable-output-encoding select="."/> and it outputs "go".

Any help will be appreciated.
Jul 20 '05 #1
2 5056
jo******@sherid anc.on.ca (Joe) writes:
How would you preserve tags from an XML element in XSLT output..

XSLT has no access to the tags in the original document, it only has
access to the input tree generated by parsing those tags.
Example:

XML document has an ELEMENT "SECTION" allowing contained HTML

This element might have an element such as <A HREF="dfksdfaj" >go</A>

I want the output from XSLT processing of the SECTION elements to
output "<A HREF="dfksdfaj" >go</A>" and not "go". I've tried <xsl:value-of
disable-output-encoding select="."/> and it outputs "go".

Never use disable-output-encoding unless you are in very special
circiumstances where it needs to be used, and even then avoid it if
possible, it is explictly a non portable feature of XSLT.

You just want

<xsl:copy-of select="SECTION "/>

if you want a copy of the SECTION element, or

<xsl:copy-of select="SECTION/node()"/>

if you want a copy of its children, without the surrounding SECTION.
Any help will be appreciated.


David
Jul 20 '05 #2
Joe
David Carlisle <da****@nag.co. uk> wrote in message news:<yg******* ******@penguin. nag.co.uk>...
jo******@sherid anc.on.ca (Joe) writes:
How would you preserve tags from an XML element in XSLT output..

XSLT has no access to the tags in the original document, it only has
access to the input tree generated by parsing those tags.
Example:

XML document has an ELEMENT "SECTION" allowing contained HTML

This element might have an element such as <A HREF="dfksdfaj" >go</A>

I want the output from XSLT processing of the SECTION elements to
output

"<A HREF="dfksdfaj" >go</A>" and not "go". I've tried <xsl:value-of
disable-output-encoding select="."/> and it outputs "go".


Never use disable-output-encoding unless you are in very special
circiumstances where it needs to be used, and even then avoid it if
possible, it is explictly a non portable feature of XSLT.

You just want

<xsl:copy-of select="SECTION "/>

if you want a copy of the SECTION element, or

<xsl:copy-of select="SECTION/node()"/>

if you want a copy of its children, without the surrounding SECTION.
Any help will be appreciated.


David

Many thanks,
It worked. Will heed your other advice.

Joe
Jul 20 '05 #3

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

Similar topics

2
1903
by: Bob | last post by:
I have an xml document that I xslt into html for display. I include various links to external (html) documents based on the specific data encountered by the xslt transform. I would like to repackage my xml/xslt/html data by transorming into text or (if I can figure it out) pdf. When I produce the text, I would like to insert the actual...
6
2752
by: mike | last post by:
regards: Is it possible to use java XML api to translate a HTML document into a XHTML document(mobile profile) thank you best wishes
3
1064
by: Martin Plantec | last post by:
This is a very simple question, from a beginner in XSLT. Suppose my XML says <para>The word <a href="there.html">link</a> goes there.</para> What XSLT rule would preserve the a element with all attributes? By now I have learned I can write:
5
4402
by: shauldar | last post by:
Is there a way (tool, hack...) to create an XSL:FO from an XSLT + XML files? My motivation is that we want to use a tool to design reports, and from that "design" generate both HTML (via XSLT) and PDF (via XSL:FO). The only tool we have seen is Altova's StyleVision, which is very unfriendly (and uses a proprietary representation, SPS, from...
3
1924
by: Grant Harmeyer | last post by:
Ok: I have done small level Xml stuff and am just now starting to understand some of the plumbing involved. I've done a lot of .NET programming for SQL Server, but little for Xml data stores. I am currently just interested in using the .xsl file that I have being applied to a source .xml file through ASP classic. Here's what I have: ...
12
5652
by: Trevor Oakley | last post by:
I am producing HTML from XslTransform (C#) and the HTML does not validate, see http://www.redburg.co.uk/mira/mira415_ev_wh_ch.html as an example. I am using the following XSLT code: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2
1703
by: Lionel Fourquaux | last post by:
In .Net 1.1, System.Xml.Xsl.XslTransform cannot output directly a document in an encoding that cannot represent all the characters used (e.g. write in us-ascii for compatibility, and convert all non-ascii chars to entities). While it can be worked around (by defining a TextWriter that does the conversion to entities), it's not very elegant...
1
1398
by: byquestion | last post by:
Hi there xslt gurus, i am kinda new to xslt and having difficulty to implement my some iterations. i need to recreate an xml file by using xslt. here is the sample xml file(input for xslt) <Flights> <Flight> <FlightLeg > <BookingClassCodeList> <BookingCode Value="C" /> <BookingCode Value="Y" /> ...
3
2454
by: Andy Dingley | last post by:
>From a thread over in c.i.w.a.h "RFC: From XHTML to HTML via XSLT" http://groups.google.co.uk/group/comp.infosystems.www.authoring.html/msg/f112c230061ffe86 As is well-known, the XSLT HTML output method should generate <br> rather than <br /or <br></br> From: <http://www.w3.org/TR/xslt#section-HTML-Output-Method> : The html output...
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
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...
0
7970
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
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...
0
5219
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.