473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

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 5040
jo******@sheridanc.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******@sheridanc.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
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...
6
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
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...
5
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)...
3
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. ...
12
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...
2
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...
1
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) ...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.