|
hi,
i cannot understand what code.. the code that i used does well in IE..and does everything I want to do..and the way i want to...but I want to know as I am creating a DOM for microsoft as new ActiveXObject("Msxml2.DOMDocument.3.0");...and also some other things which work fine in IE doesnt work in NETSCAPE..as document.all doesnt work..whatever I have searched for and found was like that..I will have to use XSL Stylesheets..to render XML and show it in Netscape.....but I am having a problem..I dont have a static XML file...so I cant create a XSL which is dynamic...so is there any other way to do it..as we do in Microsoft Internet Explorer..any hints and ideas are welcome..please help!!!!!!!!!
TIA...
himanshu
|
|
|
|
|
The code I meant was your code which is giving the problem on Netscape. If you can post that code then maybe we can help you out.
From what I can gather though I recommend you ditch the client side processing and do it all server side. It is perfectly possible to apply an XSL transform to a dynamic XML source.
The best way is to have an ASPX (or ASP page) which creates an XmlDocument and XslTransform . you then load up the XmlDocument with your dynamic XML (in .NET it can take in streams or physical files) and Response.Write out the XslTransform output.
Paul Watson Bluegrass Cape Town, South Africa
Macbeth muttered:
I am in blood / Stepped in so far, that should I wade no more, / Returning were as tedious as go o'er
DavidW wrote:
You are totally mad. Nice.
|
|
|
|
|
I did it for IE..ad it is working fine..but the same program doesnt give any output in netscape..that is because netscape doesnt support some of the methods..so there is no other way..than to write a new approach which either can work fine in both..IE and netscape..or write routines for netscape and IE...but I dont know the idea as how to start with...can you help me out..
cheers
Himanshu
|
|
|
|
|
you have to do this using server-side code.
client side code is not a good idea as you will face the problems that you have now.
you need to write this in code that executes on the webserver, so either asp or asp.net depending on which one you know.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hi,
I am using MSXML to get the response from a web server. It's really strange that everytime before I can load that page successfully, I should load that url first in my IE. Only after that, the page can be loaded in my program.
Can someone kindly tell me what the problem could be?
Thanks and nice day!
<br />
BOOL CAPIDlg::MakeRequest() {<br />
try{<br />
MSXML::IXMLHttpRequestPtr pIXMLHTTPRequest;<br />
HRESULT hResult=CoInitialize(NULL);;<br />
hResult = pIXMLHTTPRequest.CreateInstance("Microsoft.XMLHTTP");<br />
pIXMLHTTPRequest->open("POST",(_bstr_t)"http://www.yahoo.com");<br />
pIXMLHTTPRequest->send();<br />
m_XMLResult.SetWindowText(pIXMLHTTPRequest->responseText);<br />
}<br />
catch(...) {<br />
}<br />
return true;<br />
}<br />
|
|
|
|
|
Hi, I find out the mistake
The method is
pIXMLHTTPRequest->open("POST",(_bstr_t)"http://www.yahoo.com");
shoud be "GET" instead of "POST".
|
|
|
|
|
how to do the following using .NET
I have the following XML document :
<a>3.14159</a>
If I were using COM MSXML parser, I could get
NodeTypedValue property to get "strongly-typed"
value.
b= XMLDocument.SelectSingleNode("//b");
variant value = b.NodeTypedValue;
//now the variant contains double value.
The question is:
how to achieve the same using C# ?
Value property of XMLNode object returns String
type, wchich i have to convert to get desired type...
How to do this without explicit conversion (by the means
of XMLConvert class or similar...)
Thanks
Michal Januszczyk
|
|
|
|
|
I have an XML document which is as follows :
<NODE name="a">
<NODE name="b">
<NODE name="c"/>
</NODE>
</NODE>
the XSL output needs to be
a
b
c
can i do this using XSL? I am unable to do a nested looping that indents . Please help .
|
|
|
|
|
Hi,
here's an example of this I knocked together for a friend a while ago..
*********XML*********
<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="xmlnav.xsl"?>
<navigation>
<menu name="menu 1">
<option name="LEVEL 1" path="/xmlnav/level1.asp">
<option name="test level 1" path="/xmlnav/level1test.asp">
<option name="test level 1 sub option" path="/xmlnav/suboption.asp"/>
<option name="test level 1 sub option 2" path="/xmlnav/level1test.asp">
<option name="test level 1 sub sub option" path="/xmlnav/suboption.asp"/>
</option>
</option>
<option name="test level 2" path="/xmlnav/level2test.asp"/>
<option name="test level 3" path="/xmlnav/level3test.asp"/>
</option>
</menu>
<menu name="menu 2">
<option name="LEVEL 2" path="/xmlnav/level2.asp">
<option name="test menu2 sub option" path="/xslnav/suboption2.asp"/>
</option>
</menu>
</navigation>
---------------8<---------------
*********XSL*********
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1"/>
<xsl:param name="path"/>
<xsl:template match="/">
<html>
<head>
<style type="text/css">
body, td { font-family: arial; font-size: 12px }
</style>
</head>
<body>
<p>Matching company: <xsl:value-of select="$path"/></p>
<xsl:for-each select="navigation/menu">
<xsl:value-of select="@name"/><br/>
<xsl:for-each select="child::option">
<xsl:call-template name="alink">
<xsl:with-param name="nesting" select="0" />
<xsl:with-param name="loop" select="0" />
</xsl:call-template>
<br />
<xsl:call-template name="chld" >
<xsl:with-param name="nesting" select="0" />
<xsl:with-param name="loop" select="0" />
</xsl:call-template>
</xsl:for-each>
<br />
</xsl:for-each>
</body>
</html>
</xsl:template>
<xsl:template name="chld">
<xsl:param name="loop" />
<xsl:param name="nesting" />
<xsl:for-each select="child::option">
<xsl:call-template name="alink">
<xsl:with-param name="loop" select="$loop" />
<xsl:with-param name="nesting" select="$nesting + 1" />
</xsl:call-template>
<br />
<xsl:call-template name="chld">
<xsl:with-param name="loop" select="$loop" />
<xsl:with-param name="nesting" select="$nesting + 1" />
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="space">
</xsl:template>
<xsl:template name="alink">
<xsl:param name="loop" />
<xsl:param name="nesting" />
<xsl:if test="not($loop > $nesting)">
    
<xsl:call-template name="alink">
<xsl:with-param name="loop" select="$loop + 1"/>
<xsl:with-param name="nesting" select="$nesting"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$loop=$nesting">
<a>
<xsl:attribute name="href"><xsl:value-of select="@path"/></xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
---------------8<---------------
that should be more than enough to get you going
if you need an explanation then give me a shout, and I will do my humble best to clarify it.
HTH
|
|
|
|
|
This work ok . I had one more question . Now How can i diagramatically represent this heirarchical data ? Like everything is in One level I need some indentation !
Like
CRange
CKeyboard
COven
CDigitalInput
CDigitalOutput
CSettings
this would be really cool . This seems easy when programming in C/C++ , but how do i make XSL do this ?
|
|
|
|
|
Dinner time so I have to go.
Look up the parameter passing to templates. One option would be to just send a text string of blanks that is increased with each call and put that text out prior to the name you have.
www.w3schools should have a sample
""
|
|
|
|
|
My XML Document is the following
<OBJECT Class="CRange" Name="objName"><br />
<OBJECT Class="CKeyboard" Name="objName"/><br />
<OBJECT Class="COven" Name="objName"><br />
<OBJECT Class="CDigitalInput" Name="objName"/><br />
<OBJECT Class="CDigitalOutput" Name="objName"/><br />
</OBJECT><br />
<OBJECT Class="CSettings" Name="objName"/><br />
</OBJECT>
My XSLT CODe is as
<?xml version="1.0" encoding="ISO-8859-1"?><br />
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"><br />
<xsl:template match="/"><br />
<html><br />
<body><br />
<h2>AOM MODEL</h2><br />
<br>top</br><br />
<xsl:apply-templates select="OBJECT"/><br />
<xsl:for-each select="OBJECT"><br />
<xsl:apply-templates select="OBJECT"/><br />
<xsl:for-each select="OBJECT"><br />
<xsl:apply-templates select="OBJECT"/><br />
<xsl:for-each select="OBJECT"/><br />
</xsl:for-each><br />
</xsl:for-each><br />
<br />
<br />
<br />
</body><br />
</html><br />
</xsl:template><br />
<xsl:template match="OBJECT"><br />
<span style="color:#0000FF"><br />
<br><br />
<xsl:value-of select="@Class"/><br />
</br><br />
</span><br />
</xsl:template><br />
<xsl:template match="PROPERTY"><br />
<br><br />
<span style="color:#ff0000"><br />
<xsl:value-of select="."/><br />
</span><br />
</br><br />
</xsl:template><br />
</xsl:stylesheet>
The output is
AOM MODEL
top
CRange
CKeyboard
COven
CSettings
CDigitalInput
CDigitalOutput
This does not reflect the heirarchy and is wrong . What should i be doing to get
AOM MODEL
top
CRange
CKeyboard
COven
CDigitalInput
CDigitalOutput
CSettings
what am i doing wrong ? I basically need a tree traversal ? Please help
|
|
|
|
|
Is this what you want?
What processor are you using?
I had to change the xmlns to something newer to run this through MSXML 4.
I also had to correct the case of the match and select values to your xml file.
**************** XML FILE *****************
<object Class="CRange" Name="objName">
<object Class="CKeyboard" Name="objName"/>
<object Class="COven" Name="objName">
<object Class="CDigitalInput" Name="objName"/>
<object Class="CDigitalOutput" Name="objName"/>
</object>
<object Class="CSettings" Name="objName"/>
</object>
*************** XSL FILE ********************
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>AOM MODEL</h2>
<br>top</br>
<xsl:apply-templates select="object"/>
</body>
</html>
</xsl:template>
<xsl:template match="object">
<span style="color:#0000FF">
<br>
<xsl:value-of select="@Class"/>
</br>
</span>
<xsl:apply-templates select="object"/>
</xsl:template>
<xsl:template match="PROPERTY">
<br>
<span style="color:#ff0000">
<xsl:value-of select="."/>
</span>
</br>
</xsl:template>
</xsl:stylesheet>
************** out put ******************
AOM MODEL
top
CRange
CKeyboard
COven
CDigitalInput
CDigitalOutput
CSettings
<b><i>""</i></b>
|
|
|
|
|
How to display More than one XML file data using same XXLTransform object?
|
|
|
|
|
I have a xml-schema in which two elements are defined, as in code below. The first one is included in the second one using ref=”element1”. From this schema I define a dataset using DataSet.ReadXmlSchema() (in C#). The simple data types, as string and int are easy to store data in, but how do I store an object of the first element type into the dataset? I have tried to first store it in a DataRow (defined as in the xml-schema of element1) and then add it to the other Dataset, but this does not work. An Int32 type is expected for the ref-element, is this a handle to the other element? If so how do I get that handle?
Any help will be greatly appreciated!
/EnkelIk
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Register" xmlns:xs = "http://www.w3.org/2001/XMLSchema" version ="1.0"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Element1">
<xs:complexType>
<xs:sequence>
<xs:element name="str1" nillable="true" type="xs:string" />
<xs:element name="str2" nillable="true" type="xs:string" />
<xs:element name="str3" nillable="true" type="xs:string" />
<xs:element name="str4" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Element2">
<xs:complexType>
<xs:sequence>
<xs:element name="mystr1" nillable="true" type="xs:string" />
<xs:element name="mystr2" nillable="true" type="xs:string" />
<xs:element ref="Element1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
|
|
|
|
|
I'm having problems defining an array in xml.
I have defined an xml schema in a file and I create a dataset by loading the schema (in C#: DataSet.ReadXmlSchema(filename) ). It works fine for "complex types" containing strings, ints and so on, but when I try defining an array the error message reads:
"Undefined complexType 'http://schemas.xmlsoap.org/soap/encoding/:Array' is used as a base for complex type restriction".
How come the Array type is undefined? Many schemas use the same syntax from what I can tell. What am I missing?
Below is part of the xml-schema I try to use:
<xs:schema id="Register" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:s3="http://vo.lpw.ldk" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/">
<xs:element name="Register" msdata:isdataset="true" msdata:locale="sv-SE">
<xs:complextype>
<xs:choice maxoccurs="unbounded">
<xs:element name="ArrayOf_tns3_ProgRes">
<xs:complextype>
<xs:complexcontent mixed="false">
<xs:restriction base="soapenc:Array">
<xs:sequence>
<xs:element name="item" type="ProvRes" minoccurs="0" maxoccurs="unbounded">
<xs:attribute d7p1:arraytype="s3:ProvRes[]" ref="soapenc:arrayType" xmlns:d7p1="http://schemas.xmlsoap.org/wsdl/">
<xs:element name="ProgRes">
<xs:complextype>
<xs:sequence>
<xs:element name="string1" nillable="true" type="xs:string">
<xs:element name="string2" nillable="true" type="xs:string">
Best regards
/EnkelIk
|
|
|
|
|
Oops forgot to check the "display as is" checkbox.
This is the schema I try to use:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Register" xmlns="" xmlns:xs = "http://www.w3.org/2001/XMLSchema" version = "1.0"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:s3="http://vo.lpw.ladok" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
<xs:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xs:element name="Register" msdata:IsDataSet="true" msdata:Locale="sv-SE">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="ArrayOf_tns3_ProgRes">
<xs:complexType>
<xs:complexContent mixed="false">
<xs:restriction base="soapenc:Array">
<xs:sequence>
<xs:element name="item" type="ProvRes" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute d7p1:arrayType="s3:ProvRes[]" ref="soapenc:arrayType" xmlns:d7p1="http://schemas.xmlsoap.org/wsdl/" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="ProgRes">
<xs:complexType>
<xs:sequence>
<xs:element name="string1" nillable="true" type="xs:string" />
<xs:element name="string2" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
|
|
|
|
|
Did you ever figure it out, I'am having the same problem.
Thanks, Louis.
|
|
|
|
|
No, I'm sorry -I didn't. That is I found another solution. It is quite some time ago of course but from what I remember and looking into the code, I found a solution so I could manage without arrays -I simply created a more "database like" schema, so I gave element A an identity (say A1) and then in element B I introduced a property with the value of the id of the A-element to which B belonged. In the xsl I then treated element A1, selected all B-elements that belonged to A1 and managed them, then going on to the next A-element. It would have been a lot nicer with arrays of course.
I'm not sure if I will try and solve it again some day, now that I have a bit more experience of xml/xsl, but if you solve it I'm very interested to hear how you did it.
Thanks
/EnkelIk
|
|
|
|
|
I have just downloaded V3 of the SOAP toolkit from MS. The docs imply it should be possible to link a SOAP request on to most COM components using the WSDL Generator to create the needed files. So...
Does the panel think it would be possible to use an MFC app (with a dual interface to get the required IDISPATCH) as the target for SOAP.
If so this could make for a very nice remote control technique which avoids the horrors of DCOM - been there, done that, gave it up as a bad job .
Wild guesses and educated musings welcome.
Cheers
Steve
|
|
|
|
|
Someone can tell me the difference betweem xsl:import and xsl:include ? I can't get it Please don't post a description from MSDN here I have it already
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
From w3schools: Note the precedence comment.
IMPORT
http://www.w3schools.com/xsl/el_import.asp
The <xsl:import> element is a top-level element that is used to import the contents of one style sheet into another.
Note: An imported style sheet has lower precedence than the importing style sheet.
Note: This element must appear as the first child node of <xsl:stylesheet> or <xsl:transform>.
Note: Netscape 6 does not support import precedence, so this element will behave equivalent to <xsl:include>.
INCLUDE
http://www.w3schools.com/xsl/el_include.asp
Definition and Usage
The <xsl:include> element is a top-level element that includes the contents of one style sheet into another.
Note: An included style sheet has the same precedence as the including style sheet.
Note: This element must appear as a child node of <xsl:stylesheet> or <xsl:transform>.
EDIT - do not know why the sentences got trimmed but I think you can see the difference - end edit.
"I will find a new sig someday."
|
|
|
|
|
Hmm.... precedence... Can you give me a small example? Is that like this scenario:
Both imported and importing XSLTs has a xsl:template named "template". But only the importing (main) will work in case of xsl:import , right? In case of xsl:include both will be called? Same if 2 templates has same match attribute?
I think I'm lost, lol
<edited>
or in both cases they will be called, but when use import the template from main XSLT will be used first and always?
</edited>
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
You got the concept.
Make a few simple examples and step through them.
If you can not justify a xslt edit/debug purchase, try cooktop.
It is free and although does not debug, it can work with several processors and you can see the output right away.
http://www.xmlcooktop.com/[^]
"I will find a new sig someday."
|
|
|
|
|
Ah, thanx
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|