XSL Help

Everything else that doesn't fall into one of the other PB categories.
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

XSL Help

Post by Karbon »

I'm doing a lot with XSL transformations now and have run into several potentially huge problems. First, it seems to not recognize and "non-english" characters, I get a parser error when using the MSXML parser. the second is the inability to use required HTML characters in an XSL template.

I'm transforming to HTML, and the & is a reserved character so that means that I cannot include &nbsp and friends in the stylesheet (though they can be in the XML as long as they're escaped). No use of the &* characters makes it really hard to write HTML transformation templates.

Perhaps I'm going about this the wrong way all together. Hopefully someone with some experience in XML/XSL can help out here..

these are super simplified examples of what I'm doing, but you get the idea I hope.

Example of how I'm doing the XSL stylesheet :

Code: Select all

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="Example">
<html>
<head>
<title>Invoice</title>
</head>
<body>

<xsl:value-of select="First_Value"/>

<br />

<xsl:value-of select="Second_Value"/>

</body>
</html>
</xsl:template>
</xsl:stylesheet>
An example of the XML that might be associated with it :

Code: Select all

<Example>

	<First_Value>Test test test 1</First_Value>
	<Second_Value>Test test test 2</Second_Value>
	
</Example>
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
guido
User
User
Posts: 14
Joined: Tue Nov 25, 2003 4:56 pm
Location: Old Europe - Germany

Post by guido »

The non-English characters should be easy to fix: add an

Code: Select all

encoding="ISO-8859-1" 
attribute to the XML tag.

If generating HTML text-like stuff, I recommend using the <xsl:text> tag; of course one has to quote it, so

Code: Select all

&nbsp;
will transform to

Code: Select all

&nbsp;
but it should work and is only ugly, not difficult.
guido
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

guido wrote:If generating HTML text-like stuff, I recommend using the <xsl:text> tag; of course one has to quote it, so

Code: Select all

&nbsp;
will transform to

Code: Select all

&nbsp;
but it should work and is only ugly, not difficult.
Can you show me an example of how you're using the <xsl:text> tag? Are you using it to output the HTML tags as well?

MANY thanks for the encoding tip!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Resurrecting this to ask for some more help.. It seems using :

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
Doesn't help the display of some characters at all (I'm not sure what the chatacters are as they can't be displayed in a text editor on my version of Windows either)..

Any other hints?
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Post Reply