473,505 Members | 14,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML Output in XSLT

Hello there!

I have a couple of questions about generating HTML using an XSLT Stylesheet.

I use the System.Xml and System.Xml.Xsl namespaces and a XslTransform object
to make the transformation, as follows:

xsltTemplate.Transform(xmlOutput.CreateNavigator, Nothing,
xmlWriter, Nothing)
The XSLT template I use is this one:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="html">
<span>Welcome to the NEXT LEVEL!</span><br/>

<xsl:copy-of select="select"/><br/>
<xsl:copy-of select="div/a"/><br/>

<span>Welcome to the NEXT LEVEL!</span>
<a href="Home.aspx?id=a&id2=b" at="at">a</a>
<br/>
<!--<xsl:text> </xsl:text>-->
</xsl:template>
</xsl:stylesheet>

I need that the HTML Output includes the HTML entity but instead it
outputs a &nbsp; string. Also I want to write the href attribute of the <a>
elements on the xstl stylesheet without the need of the & XML entity in as
parameter separator like this: page.aspx?a=1&b=2 instead of this:
page.aspx?a=1&amp;b=2

I've already tried adding the <xsl:output> element with the HTML method, but
I get the same resutls.

Thanks for your help.
Nov 12 '05 #1
3 1216


Fredy Muñoz [MCP] wrote:
Also I want to write the href attribute of the <a>
elements on the xstl stylesheet without the need of the & XML entity in as
parameter separator like this: page.aspx?a=1&b=2 instead of this:
page.aspx?a=1&amp;b=2


Well
<a href="page.aspx?a=1&amp;b=2">
is correct HTML while
<a href="page.aspx?a=1&b=2">
is not, try an HTML validator.
So the result is fine if you want HTML output.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
And what about the HTML entities?
Nov 12 '05 #3
Fredy Muñoz [MCP] wrote:
I have a couple of questions about generating HTML using an XSLT Stylesheet.

I use the System.Xml and System.Xml.Xsl namespaces and a XslTransform object
to make the transformation, as follows:

xsltTemplate.Transform(xmlOutput.CreateNavigator, Nothing,
xmlWriter, Nothing)


Beware that when transforing to XmlWriter you are generating XML, not
HTML (xsl:output instruction is ignored). Transform to Stream or
TextWriter to get real HTML.
ANd there is no way to get entities out of XSLT, it just has no idea
what they are. You can postprocess transformation result to convert
charcters to entities, but usually that makes no sense.

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
http://blog.tkachenko.com
Nov 12 '05 #4

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

Similar topics

1
3024
by: hongping | last post by:
I am having problems transforming a xml doc into html with proper indenting. Here is the xslt <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"...
2
5047
by: Joe | last post by:
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...
2
2092
by: Taare | last post by:
Hi, I got <xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system=" http://www.w3.org/TR/html4/strict.dtd"/> in my XSLT file. This should remove...
5
3584
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
1
1093
by: Slipperman | last post by:
say i have 2 xml files i want to combine and format using XSLT but i'd like to route the output to an HTML file. can this be done?? every sample i've seen on the net is using Console.Out which...
1
1255
by: Thom Anderson | last post by:
Hi, I'm a newbee at XML so I need to ask this. I have an xml data like follows. <?xml version="1.0" encoding="utf-8" ?> <salesRep repnum="123" orgdate="16"> <fname>Joe</fname>...
5
1919
by: eva.mukhija | last post by:
Hi I need to insert some html content generated by certain business logic into an xsl output. I have been able to insert custom Java extensions and generate the HTML to be outputted. My problem...
3
2450
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...
3
9522
by: realmerl | last post by:
Hi All. I'm trying to transform a html document into plain text via xslt. Simple you say! (i hope) I have got it working, by using the magnificent <xsl:value-of select="."/>. This returns the...
4
11886
by: mark4asp | last post by:
I have an element, report which contains tags which have been transformed. E.g. <pis &lt;p&gt <myXml> <report>This text has html tags in it.&lt;p&gt which but <has been changed to &lt;&gt</report>...
0
7216
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
7098
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
7303
Oralloy
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,...
1
7018
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
5613
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,...
1
5028
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...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
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 ...
1
754
muto222
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.