-
XSLT conversion problem using VB.NET and character refrences
Hello out there,
we are doing XSLT conversions via VB6.
Now i attempted to write a small conversion program using VB.NET
and i attempted a problem with character refrences.
Maybe somebody out there can help me.
The problem:
In our XML documents we use charcter refrences like ß to encode any
characters which are not US Ascii.
I am doing the conversion from XML to HTML using System.Xml.Xsl.XslTransform()like
below.
(In VB6 this is working fine)
BUT in VB.NET all THESE character refrences are not displayed correctly
(NONSENSE characters instead)
IF i load the file in IE6.0 using the style sheet directly everything is
OK
Can anybody help me ?
Greetings
Michael
Dim xslt As New System.Xml.Xsl.XslTransform()
Dim out As System.IO.StreamWriter
'Dim writer As System.Xml.XmlTextWriter()
Try
out = File.CreateText(m_strActDir + "\out.htm")
xslt.Load("file://" + m_strActXSL)
Dim xpathdocument As New System.Xml.XPath.XPathDocument("file://"
+ m_strActXML)
Dim writer As New System.Xml.XmlTextWriter(out)
writer.Formatting = System.Xml.Formatting.Indented
xslt.Transform(xpathdocument, Nothing, writer)
writer.Close()
Style Sheet:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl utput method='html' omit-xml-declaration='yes'/>
<xsl:template match="/">
...
XML Dok. sample:
<?xml version='1.0'?> <!DOCTYPE topic SYSTEM 'MedaPS2.dtd'>
<?xml-stylesheet href="medaps_convert2HTML.xsl" type="text/xsl"?>
<topic>
<metalist>
<meta name="Generator" value="SCHEMA MarkupKit 2.0"/>
</metalist>
<mtable>
<table hsdl-percent="21.1 8.5 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7" type="t_TDv">
<thead>
<tr>
<th><p>Schalten von Lasten<br/>Insta Schütze 5TT3 7</p></th>
<th></th>
<th><p>20 A</p></th>
<th><p>21 A</p></th>
<th><p>24 A</p></th>
<th><p>25 A</p></th>
<th><p>40 A<br/>Schließer</p></th>
<th><p>40 A<br/>Öffner</p></th>
...
-
Re: XSLT conversion problem using VB.NET and character refrences
Encode the string "ß" as "&#223;" in you xslt file. This will
generate the string "ß" in its HTML output, then your browser can
render it to the appropriate character.
Cheers,
Jason
"Michael" <Michael.Stettner@siemens.com> wrote in message
news:3df4702b@tnews.web.devx.com...
>
> Hello out there,
>
> we are doing XSLT conversions via VB6.
>
> Now i attempted to write a small conversion program using VB.NET
> and i attempted a problem with character refrences.
>
> Maybe somebody out there can help me.
>
> The problem:
>
> In our XML documents we use charcter refrences like ß to encode any
> characters which are not US Ascii.
>
> I am doing the conversion from XML to HTML using
System.Xml.Xsl.XslTransform()like
> below.
> (In VB6 this is working fine)
>
> BUT in VB.NET all THESE character refrences are not displayed correctly
> (NONSENSE characters instead)
>
> IF i load the file in IE6.0 using the style sheet directly everything is
> OK
>
> Can anybody help me ?
>
> Greetings
> Michael
>
> Dim xslt As New System.Xml.Xsl.XslTransform()
> Dim out As System.IO.StreamWriter
> 'Dim writer As System.Xml.XmlTextWriter()
> Try
>
> out = File.CreateText(m_strActDir + "\out.htm")
>
> xslt.Load("file://" + m_strActXSL)
> Dim xpathdocument As New
System.Xml.XPath.XPathDocument("file://"
> + m_strActXML)
>
> Dim writer As New System.Xml.XmlTextWriter(out)
>
> writer.Formatting = System.Xml.Formatting.Indented
>
> xslt.Transform(xpathdocument, Nothing, writer)
> writer.Close()
>
>
>
>
> Style Sheet:
>
> <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:msxsl="urn:schemas-microsoft-com:xslt">
> <xsl utput method='html' omit-xml-declaration='yes'/>
>
> <xsl:template match="/">
> ..
>
>
>
> XML Dok. sample:
>
>
> <?xml version='1.0'?> <!DOCTYPE topic SYSTEM 'MedaPS2.dtd'>
> <?xml-stylesheet href="medaps_convert2HTML.xsl" type="text/xsl"?>
> <topic>
>
> <metalist>
>
> <meta name="Generator" value="SCHEMA MarkupKit 2.0"/>
> </metalist>
>
> <mtable>
> <table hsdl-percent="21.1 8.5 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7"
type="t_TDv">
> <thead>
> <tr>
> <th><p>Schalten von Lasten<br/>Insta Schütze 5TT3 7</p></th>
> <th></th>
> <th><p>20 A</p></th>
> <th><p>21 A</p></th>
> <th><p>24 A</p></th>
> <th><p>25 A</p></th>
> <th><p>40 A<br/>Schließer</p></th>
> <th><p>40 A<br/>Öffner</p></th>
> ..
-
Re: XSLT conversion problem using VB.NET and character refrences
Hallo Jason,
how do you mean that ?
The character refrences are inside the xml document
how can i convert them in the xslt file ?
Greetings
Michael
"Jason Sobell - iGadget" <iGadget_@hotmail.com> wrote:
>Encode the string "ß" as "ß" in you xslt file. This will
>generate the string "ß" in its HTML output, then your browser can
>render it to the appropriate character.
>
>Cheers,
> Jason
>
>"Michael" <Michael.Stettner@siemens.com> wrote in message
>news:3df4702b@tnews.web.devx.com...
>>
>> Hello out there,
>>
>> we are doing XSLT conversions via VB6.
>>
>> Now i attempted to write a small conversion program using VB.NET
>> and i attempted a problem with character refrences.
>>
>> Maybe somebody out there can help me.
>>
>> The problem:
>>
>> In our XML documents we use charcter refrences like ß to encode any
>> characters which are not US Ascii.
>>
>> I am doing the conversion from XML to HTML using
>System.Xml.Xsl.XslTransform()like
>> below.
>> (In VB6 this is working fine)
>>
>> BUT in VB.NET all THESE character refrences are not displayed correctly
>> (NONSENSE characters instead)
>>
>> IF i load the file in IE6.0 using the style sheet directly everything
is
>> OK
>>
>> Can anybody help me ?
>>
>> Greetings
>> Michael
>>
>> Dim xslt As New System.Xml.Xsl.XslTransform()
>> Dim out As System.IO.StreamWriter
>> 'Dim writer As System.Xml.XmlTextWriter()
>> Try
>>
>> out = File.CreateText(m_strActDir + "\out.htm")
>>
>> xslt.Load("file://" + m_strActXSL)
>> Dim xpathdocument As New
>System.Xml.XPath.XPathDocument("file://"
>> + m_strActXML)
>>
>> Dim writer As New System.Xml.XmlTextWriter(out)
>>
>> writer.Formatting = System.Xml.Formatting.Indented
>>
>> xslt.Transform(xpathdocument, Nothing, writer)
>> writer.Close()
>>
>>
>>
>>
>> Style Sheet:
>>
>> <xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> xmlns:msxsl="urn:schemas-microsoft-com:xslt">
>> <xsl utput method='html' omit-xml-declaration='yes'/>
>>
>> <xsl:template match="/">
>> ..
>>
>>
>>
>> XML Dok. sample:
>>
>>
>> <?xml version='1.0'?> <!DOCTYPE topic SYSTEM 'MedaPS2.dtd'>
>> <?xml-stylesheet href="medaps_convert2HTML.xsl" type="text/xsl"?>
>> <topic>
>>
>> <metalist>
>>
>> <meta name="Generator" value="SCHEMA MarkupKit 2.0"/>
>> </metalist>
>>
>> <mtable>
>> <table hsdl-percent="21.1 8.5 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7"
>type="t_TDv">
>> <thead>
>> <tr>
>> <th><p>Schalten von Lasten<br/>Insta Schütze 5TT3 7</p></th>
>> <th></th>
>> <th><p>20 A</p></th>
>> <th><p>21 A</p></th>
>> <th><p>24 A</p></th>
>> <th><p>25 A</p></th>
>> <th><p>40 A<br/>Schließer</p></th>
>> <th><p>40 A<br/>Öffner</p></th>
>> ..
>
>
-
Re: XSLT conversion problem using VB.NET and character refrences
Hmm.. I suspect you are using an HTML news reader 
OK, sorry, I missed one of your points.
If you want to maintain the format of the data in '&#xxx' format through to
HTML then you would have to code it as &#xxx; in your XML source.
What are you using in VB.NET to display this output? Does it matter what the
results look like in VB.NET if you want them to be viewed in an HTML
browser, or are you trying to do something else?
Please describe what you are trying to do, rather than just what the
symptoms are 
Cheers,
Jason
p.s. My SL45i has developed a crack in it's case. Can I send it to you and
have it replaced? Please? Pretty please? 
p.p.s. Don't you hate it when everyone assumes you work in the mobile phone
department?
"Michael" <Michael.Stettner@siemens.com> wrote in message
news:3df4b2dc$1@tnews.web.devx.com...
>
> Hallo Jason,
>
> how do you mean that ?
>
> The character refrences are inside the xml document
> how can i convert them in the xslt file ?
>
> Greetings
> Michael
>
> "Jason Sobell - iGadget" <iGadget_@hotmail.com> wrote:
> >Encode the string "ß" as "ß" in you xslt file. This will
> >generate the string "ß" in its HTML output, then your browser can
> >render it to the appropriate character.
> >
> >Cheers,
> > Jason
> >
> >"Michael" <Michael.Stettner@siemens.com> wrote in message
> >news:3df4702b@tnews.web.devx.com...
> >>
> >> Hello out there,
> >>
> >> we are doing XSLT conversions via VB6.
> >>
> >> Now i attempted to write a small conversion program using VB.NET
> >> and i attempted a problem with character refrences.
> >>
> >> Maybe somebody out there can help me.
> >>
> >> The problem:
> >>
> >> In our XML documents we use charcter refrences like ß to encode any
> >> characters which are not US Ascii.
> >>
> >> I am doing the conversion from XML to HTML using
> >System.Xml.Xsl.XslTransform()like
> >> below.
> >> (In VB6 this is working fine)
> >>
> >> BUT in VB.NET all THESE character refrences are not displayed
correctly
> >> (NONSENSE characters instead)
> >>
> >> IF i load the file in IE6.0 using the style sheet directly everything
> is
> >> OK
> >>
> >> Can anybody help me ?
> >>
> >> Greetings
> >> Michael
> >>
> >> Dim xslt As New System.Xml.Xsl.XslTransform()
> >> Dim out As System.IO.StreamWriter
> >> 'Dim writer As System.Xml.XmlTextWriter()
> >> Try
> >>
> >> out = File.CreateText(m_strActDir + "\out.htm")
> >>
> >> xslt.Load("file://" + m_strActXSL)
> >> Dim xpathdocument As New
> >System.Xml.XPath.XPathDocument("file://"
> >> + m_strActXML)
> >>
> >> Dim writer As New System.Xml.XmlTextWriter(out)
> >>
> >> writer.Formatting = System.Xml.Formatting.Indented
> >>
> >> xslt.Transform(xpathdocument, Nothing, writer)
> >> writer.Close()
> >>
> >>
> >>
> >>
> >> Style Sheet:
> >>
> >> <xsl:stylesheet version="1.0"
> >xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >> xmlns:msxsl="urn:schemas-microsoft-com:xslt">
> >> <xsl utput method='html' omit-xml-declaration='yes'/>
> >>
> >> <xsl:template match="/">
> >> ..
> >>
> >>
> >>
> >> XML Dok. sample:
> >>
> >>
> >> <?xml version='1.0'?> <!DOCTYPE topic SYSTEM 'MedaPS2.dtd'>
> >> <?xml-stylesheet href="medaps_convert2HTML.xsl" type="text/xsl"?>
> >> <topic>
> >>
> >> <metalist>
> >>
> >> <meta name="Generator" value="SCHEMA MarkupKit 2.0"/>
> >> </metalist>
> >>
> >> <mtable>
> >> <table hsdl-percent="21.1 8.5 8.7 8.7 8.7 8.7 8.7 8.7 8.7 8.7"
> >type="t_TDv">
> >> <thead>
> >> <tr>
> >> <th><p>Schalten von Lasten<br/>Insta Schütze 5TT3 7</p></th>
> >> <th></th>
> >> <th><p>20 A</p></th>
> >> <th><p>21 A</p></th>
> >> <th><p>24 A</p></th>
> >> <th><p>25 A</p></th>
> >> <th><p>40 A<br/>Schließer</p></th>
> >> <th><p>40 A<br/>Öffner</p></th>
> >> ..
> >
> >
>
-
Re: XSLT conversion problem using VB.NET and character refrences
Hello Jason,
sorry i cannot follow.
My problem is the we user character refrences i our XML data
like: ß Schließer : UNICODE for ß
Ö Öffner : UNICODE for Ö
this is a vlaid way to encode UNIcode characters in XML
and normally this works fine (in VB6 and in IE6) as explained.
But if i perfom the XSL Transformation with
Dim xslt As New System.Xml.Xsl.XslTransform()
Dim out As System.IO.StreamWriter
Dim writer As New System.Xml.XmlTextWriter(out)
then the output is
Schließer instead of Schließer
and
Öffner instead of Öffner
Greetings
Michael
>p.p.s. Don't you hate it when everyone assumes you work in the mobile phone
department?
p.p.p.s: no - but i really do not work in the mobile phone department
-
Re: XSLT conversion problem using VB.NET and character refrences
I see the problem now 
You have to specify the output method as being UTF-16, such as
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl utput method="html" encoding="UTF-16"/>
Cheers,
Jason
"Michael" <Michael.Stettner@siemens.com> wrote in message
news:3df5e2f2$1@tnews.web.devx.com...
>
> Hello Jason,
>
> sorry i cannot follow.
>
> My problem is the we user character refrences i our XML data
>
> like: ß Schließer : UNICODE for ß
> Ö Öffner : UNICODE for Ö
>
> this is a vlaid way to encode UNIcode characters in XML
> and normally this works fine (in VB6 and in IE6) as explained.
>
> But if i perfom the XSL Transformation with
>
> Dim xslt As New System.Xml.Xsl.XslTransform()
> Dim out As System.IO.StreamWriter
> Dim writer As New System.Xml.XmlTextWriter(out)
>
> then the output is
>
> SchlieÃYer instead of Schließer
> and
> Ã-ffner instead of Öffner
>
>
> Greetings
>
> Michael
>
>
>
> >p.p.s. Don't you hate it when everyone assumes you work in the mobile
phone
> department?
>
> p.p.p.s: no - but i really do not work in the mobile phone department
>
>
-
Re: XSLT conversion problem using VB.NET and character refrences
Hallo Jason,
sorry - i tried this but it did not succed
Nevertheless - thanx for your efforts
Greetings
Michael
"Jason Sobell - iGadget" <iGadget_@hotmail.com> wrote:
>I see the problem now 
>You have to specify the output method as being UTF-16, such as
><?xml version="1.0" encoding="UTF-8"?>
><xsl:stylesheet version="1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
><xsl utput method="html" encoding="UTF-16"/>
>
>Cheers,
> Jason
>
>"Michael" <Michael.Stettner@siemens.com> wrote in message
>news:3df5e2f2$1@tnews.web.devx.com...
>>
>> Hello Jason,
>>
>> sorry i cannot follow.
>>
>> My problem is the we user character refrences i our XML data
>>
>> like: ß Schließer : UNICODE for ß
>> Ö Öffner : UNICODE for Ö
>>
>> this is a vlaid way to encode UNIcode characters in XML
>> and normally this works fine (in VB6 and in IE6) as explained.
>>
>> But if i perfom the XSL Transformation with
>>
>> Dim xslt As New System.Xml.Xsl.XslTransform()
>> Dim out As System.IO.StreamWriter
>> Dim writer As New System.Xml.XmlTextWriter(out)
>>
>> then the output is
>>
>> SchlieÃYer instead of Schließer
>> and
>> Ã-ffner instead of Öffner
>>
>>
>> Greetings
>>
>> Michael
>>
>>
>>
>> >p.p.s. Don't you hate it when everyone assumes you work in the mobile
>phone
>> department?
>>
>> p.p.p.s: no - but i really do not work in the mobile phone department
>>
>>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|