|
Hope this sample XSL file will work for you.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table border="2" rows="10" cols="10">
<xsl:for-each select="CARO_BOARD/CHESS">
<xsl:variable name="test_x" select="@x" />
<xsl:variable name="test_y" select="@y" />
<tr>
<xsl:if test="$test_x =1 and $test_y=1" >
<td><xsl:value-of select="@sign"/></td>
<td>NULL</td>
</xsl:if>
</tr>
<tr>
<xsl:if test="$test_x =1 and $test_y=2" >
<td>NULL</td>
<td><xsl:value-of select="@sign"/></td>
</xsl:if>
</tr>
<xsl:comment>You can include more if statements </xsl:comment>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-- modified at 5:05 Tuesday 27th September, 2005
|
|
|
|
|
Thanks a lot!
But the number of rows(=10) and the number of cols(=10) can be changed.I don't want to hard code like "
"
So is there a solution?
|
|
|
|
|
Actually using DHTML it is possible to change velues of attributes in HTML tag but i think it'll be difficult to use in XSL file but i'll try to find out solution of this problem.
|
|
|
|
|
Finally i have done what u actually want
Let this is ur XML file in which u have defined row,col and border
<CARO_BOARD row="3" col="10" border="3">
<CHESS x="1" y="1" sign="X"/>
<CHESS x="1" y="2" sign="0"/>
<CHESS x="3" y="1" sign="X"/>
<CHESS x="4" y="4" sign="0"/>
</CARO_BOARD>
----------------------------------------
In this xsl we can use xsl:attribute-set to set attributes of table.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:attribute-set name="set_table">
<xsl:attribute name="border">
<xsl:variable name="chk_border" select="//@border" />
<xsl:value-of select="$chk_border"/>
</xsl:attribute>
<xsl:attribute name="cols">
<xsl:variable name="chk_cols" select="//@col" />
<xsl:value-of select="$chk_cols"/>
</xsl:attribute>
<xsl:attribute name="rows">
<xsl:variable name="chk_rows" select="//@row" />
<xsl:value-of select="$chk_rows"/>
</xsl:attribute>
</xsl:attribute-set>
<xsl:template match="/">
<html>
<body>
<table xsl:use-attribute-sets="set_table">
<xsl:for-each select="CARO_BOARD/CHESS">
<xsl:variable name="test_x" select="@x" />
<xsl:variable name="test_y" select="@y" />
<tr>
<xsl:if test="$test_x =1 and $test_y=1" >
<td><xsl:value-of select="@sign"/></td>
<td>NULL</td>
</xsl:if>
</tr>
<tr>
<xsl:if test="$test_x =1 and $test_y=2" >
<td>NULL</td>
<td><xsl:value-of select="@sign"/></td>
</xsl:if>
</tr>
<xsl:comment>You can include more if statements </xsl:comment>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
please let me know if u have any further query.
-- modified at 2:47 Monday 3rd October, 2005
|
|
|
|
|
Hi,
I was wondering whether with all these ASP.NET controls available, is XSLT still a good technology to persue? I know that its still the best way to transform XML into other formats, but if we are only interested in dragging data off a DB and displaying on web pages, wouldn't things like ASP.NET DataGrids/Lists etc. be a better choice?
We used to do a lot of XSLT trans when we were using classic ASP (we kindda hated the ASP Design Time Controls).
I kindda get the impression that ASP.NET Server controls wouldn't go well with XSL (e.g. you can't build a web page containing server controls through a XML->XHTML transform using XSL, right?).
Cheers,
Sameera
|
|
|
|
|
Hi Everyone,
I generate an xml file like:
<links><title>sth..
<desc>sth desc
<title>sth..
<desc>sth desc
and I use ASP to parse and display it in a webpage, my asp code works very well to most of the xml files, but there is one file it can not parse, and if I change the "sth desc" in the <desc> tag, it works fine.
Because the desc comes from database, I wonder if there are some limited (like length or special charaters)for the content in the tag?
Please help me!!
Thanks a lot in advance!
Alan
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
this probably an easy question but i am new to xml. how do i use an xml document to store informatiion needed by my program? i know how to create the xml document itself but dont know how to do any thing with it after that (including opening it so the program can access it, compare strings to the data in the xml document, and write to the document from the program).
i hope this is an easy question for someone to answer. any help would be greatly apprectiated. examples of code would be extremely helpful.
Kyle
|
|
|
|
|
Hi All,
How can I pass the value of an element to a Javascript function in an XSL file?
Here is a piece of my XSL file:
<xsl:for-each select="CALL-HISTORY/SEGMENT">
<tr onMouseOver="Over('MCF', 'DWS5',this)" onMouseOut="Out(this)">
<td> <NOBR><xsl:value-of select="TIME-RECORDED"/></NOBR> </td>
I need to replace the 'MCF' in the second line with the value of whatever is in:
<xsl:value-of select="OPERATOR"/>
I thought there might be a way to save off the value of the OPERATOR so that I can pass it to the Over() Javascript function.
Can anyone give me any guidance on this?
I hope this is clear, and appreciate any help.
Thanks,
Melena
|
|
|
|
|
Hi All,
I have found the resolution to my problem.
I used the same format as the xsl code below, which allowed me to pass
the <xsl:value-of...> values to my Javascript program.
<xsl:attribute name="onmouseover">
popUp('<xsl:value-of select="MENUNAME"/>',event)
</xsl:attribute>
<xsl:attribute name="onmouseout">
popDown('<xsl:value-of select="MENUNAME"/>')
</xsl:attribute>
Melena
-- modified at 19:18 Monday 19th September, 2005
|
|
|
|
|
my problem is that i have an excel sheet which should be converted into xsd,xmldoc,and stylesheet.please tell me the exact procedure to do the above explained task.
yeswanth reddy
|
|
|
|
|
Hi Friends,
I have one XML file with 4 tables in it and they r related with each other.
I want data from one table but the depending on the value of key in the other tabel.
It like we write queries for joins in sql or nested query in sql.
Is it possible?
If it is then plz tell me how to do that.
Thank u all in advance
|
|
|
|
|
Help...
I am after a way to display a DataGrid's xml (run through xls) and re-dislayed as html. I am getting the Datagrid xml using the underlying dataset's GetXML() method.
If I have 2 differing datagrids on the page, I want to be able to iteratively loop through each DG's xml via xsl, in each datagrid, and send the resulting html off in an email. Is ther esome way I can use the same template to loop through the 2 samples (and potentially others) below? These 2 xml blobs are part of 1 larger one.
2 xml samples from each data grid is below:
<NewDataSet> <person> <id>1</id> <firstName>Bob</firstName> <lastName>Smith</lastName> </person> <person> <id>2</id> <firstName>Tom</firstName> <lastName>Piper</lastName> </person> <person> <id>3</id> <firstName>Peter</firstName> <lastName>Piper</lastName> </person> </NewDataSet>
<NewDataSet> <Position> <KeyCol>1</KeyCol> <Classification>APS 3</Classification> <Number>5</Number> <SupervisorNumber>5476</SupervisorNumber> <CreationDate>30/08/2005</CreationDate> <EndDate>15/09/2005</EndDate> </Position> <Position> <KeyCol>2</KeyCol> <Classification>APS 5</Classification> <Number>55</Number> <SupervisorNumber>45476</SupervisorNumber> <CreationDate>31/08/2005</CreationDate> <EndDate>14/09/2005</EndDate> </Position> </NewDataSet>
|
|
|
|
|
This file is part of Windows SharePoint Services (WSS) and is used to store information about themes. Here is a snippet of the contents:
<spthemes xmlns="http://tempuri.org/SPThemes.xsd">
<templates>
<templateid>none
<displayname>No Theme(Default)
<description>Description
<thumbnail>../images/thnone.png
<preview>../images/thnone.gif
<templates>
<templateid>af.........etc
I am try to write a bit of code that will find a node using
node = doc.SelectSingleNode("/SPThemes/Templates[TemplateID='SOME_THEME_NAME']");
This bit if code works for an xml file that does not contain a namespace (i.e. in the xml sample above "xmlns="http://tempuri.org/SPThemes.xsd"), but with a namespace the code will not work.
Any ideas will be mucg appreciated
|
|
|
|
|
The xml did not display correctly above, therefore here is an encoded version
<?xml version="1.0" encoding="utf-8"?>
<SPThemes xmlns="http://tempuri.org/SPThemes.xsd">
<Templates>
<TemplateID>none</TemplateID>
<DisplayName>No Theme(Default)</DisplayName>
<Description>Description</Description>
<Thumbnail>../images/thnone.png</Thumbnail>
<Preview>../images/thnone.gif</Preview>
</Templates>
<Templates>
<TemplateID>af......etc
|
|
|
|
|
Assumption: both my server and client will use
System.Runtime.Remoting.RemotingConfiguration.Configure(configFile)
to read configuration file
Following are couple of ways I tried, none of them works:
(1)SERVER side:
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="ipc" portName="IpcChannelOne"/>
<channel ref="ipc" portName="IpcChannelTwo"/>
</channels>
<service>
<wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
objectUri="RemoteObjectOne.rem"
mode="Singleton" />
<wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
objectUri="RemoteObjectTwo.rem"
mode="Singleton" />
</service>
</application>
</system.runtime.remoting>
</configuration>
CLIENT side:
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="MyInterface.IRemoteObjectOne,
InterfaceAssembly"
url=ipc://IpcChannelOne/RemoteObjectOne.rem"/>
<wellknown type="MyInterface.IRemoteObjectTwo,
InterfaceAssembly"
url="ipc://IpcChannelTwo/RemoteObjectTwo.rem"/>
</client>
</application>
</system.runtime.remoting>
</configuration>
(2)SERVER side
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="ipc" portName="IpcChannelOne"/>
</channels>
<service>
<wellknown type="MyServer.RemoteObjectOne,ServerAssembly"
objectUri="RemoteObjectOne.rem"
mode="Singleton" />
</service>
<channels>
<channel ref="ipc" portName="IpcChannelTwo"/>
</channels>
<service>
<wellknown type="MyServer.RemoteObjectTwo,ServerAssembly"
objectUri="RemoteObjectTwo.rem"
mode="Singleton" />
</service>
</application>
</system.runtime.remoting>
</configuration>
CLIENT side:
no change
(3)SERVER side:
<configuration>
<system.runtime.remoting>
<application>
<service>
<channels>
<channel ref="ipc" portName="IpcChannelOne"/>
</channels>
<wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
objectUri="RemoteObjectOne.rem"
mode="Singleton" />
</service>
<service>
<channels>
<channel ref="ipc" portName="IpcChannelTwo"/>
</channels>
<wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
objectUri="RemoteObjectTwo.rem"
mode="Singleton" />
</service>
</application>
</system.runtime.remoting>
</configuration>
CLIENT side:
no change
(4)SERVER side
<configuration>
<system.runtime.remoting>
<application>
<service>
<channels>
<channel ref="ipc" portName="IpcChannelOne"/>
</channels>
<wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
objectUri="RemoteObjectOne.rem"
mode="Singleton" />
<channels>
<channel ref="ipc" portName="IpcChannelTwo"/>
</channels>
<wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
objectUri="RemoteObjectTwo.rem"
mode="Singleton" />
</service>
</application>
</system.runtime.remoting>
</configuration>
CLIENT side:
no change
Please advise what is the right way to create both client and server side
configuration files.
Your help is highly appreciated!
Hang
|
|
|
|
|
Can you name a commercially available tool for XML-FO printing and forms design?
I see different offerings on the Web, such as Crane Softwrights Ltd, but I was hoping for a word-of-mouth endorsement from somebody.
thanks
|
|
|
|
|
Hi,
Using the XmlDocument class, when i try to load a xml file that doesn't contain the root node, only the '?xml version="1.0" encoding="utf-8"?' tag, i get an error.
I load the file like this:
XmlDocument doc = new XmlDocument();
doc.Load(@"C:\Myfile.xml");
Should XmlDocument class be used to open files with an existing root node?
|
|
|
|
|
Heinz Suez wrote:
Should XmlDocument class be used to open files with an existing root node?
Yes, because every XML document MUST have exactly one root element. ( see XML spec, http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-document[^] )
How to do it? Create empty XmlDocument and add root element to it. Then read XML file (e.g with TextReader ) and set InnerXml property of root element to this loaded xml (it must be loaded into string of course).
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
i have posted questions about SOAP,but none of them are ansered
i also see some other SOAP submitions which are not answered..
codeproject don't even provide a messageboard for it
so now i'll do it my self..
thanks codeproject for inspiring me with your unsportive nature toward SOAP
otherwise you peple are doing great
good day
sagar
love is photogenic, it requires a dark to develope
|
|
|
|
|
You generally get what you pay for. Here, you get more, but not enough to complain if something does not get answered. You seem to have no idea how this site works - the articles are submitted by readers, not by the site owners. The people helping you are not paid by CP, we're just coders like you.
You've been asking the same ( complex ) question about SOAP over and over. If you want to call a dll from SOAP, you need to write an app that communicates with your web service, and with the dll. SOAP is XML over HTTP, you can't send a SOAP Envelope which magically runs a program on the other end.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, can anyone help me out with encrypting elements in a XML document using an algorithm like AES for example? I use VS.NET(C#) 2003 and apparently 2005 is easier but different? I'm kinda new to XML so please excuse me. Any information such as links to tutorials or the code itself will help.
Thanks
|
|
|
|
|
Donnie13 wrote:
Hi, can anyone help me out with encrypting elements in a XML document using an algorithm like AES for example?
I am not sure exactly what you are asking...
Why would the fact that its an XML document be any different in the way you encrypt? If you are asking about using AES itself you might find this[^] useful.
Quran
Translation
Intro
Discover
|
|
|
|
|
Good Day,
I'm trying to make a stylesheet that will sum up values and return the sum, this is what I have so far :
<xsl:template name="SumProducts">
<xsl:param name="pNodes" select="/.."/>
<xsl:param name="cNodes" select="/.."/>
<xsl:param name="result" select="0"/>
<xsl:choose>
<xsl:when test="$pNodes">
<xsl:call-template name="SumProducts">
<xsl:with-param name="pNodes"
select="$pNodes[position()!=1]"/>
<xsl:with-param name="cNodes"
select="$cNodes"/>
<xsl:with-param name="result"
select="$result
+ $pNodes[1]/Count * $cNodes[Project=$pNodes[1]/Project]/Cost"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$result"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
The problem I am having is "$pNodes[1]/Count * $cNodes[Project=$pNodes[1]/Project]/Cost" if I remove the second part of the expression (starting with $cNodes) it works (just sums up the project count) However when I try and mult. by the cost the value returned is always NaN. I have a feeling that I am missing something oblivous. Can any one help? below is the xml that goes with the stylesheet
thanks,
james
<NewDataSet>
<Table1>
<Project>Box Maker</Project>
<Count>175</Count>
<AuthorCount>71</AuthorCount>
</Table1>
<Table2>
<Author>Bill Smith</Author>
<Address>blah blah</Address>
<Date>1/20/2002</Date>
</Table2>
<Table3>
<Project>Shopbot-O-Graph</Project>
<Cost>0</Cost>
</Table3>
</NewDataSet>
|
|
|
|
|
Hi,
As you might know i'm a newbie to xml with c#, i have been surfing the net to find examples for creting nodes. I found this useful stuff in http://www.csharphelp.com/archives/archive199.html[^]
This thing works fine BUT if you open the created file with notepad you'll notice that all nodes are written in the same line.
Does anyone know how to create nodes and xml stuff in a tree way?
Thanx
-- modified at 22:54 Tuesday 6th September, 2005
|
|
|
|
|
Try myDoc.PreserveWhitespace = true before calling the save method.
Actually, the docs say this:
If PreserveWhitespace is true before Save is called, white space in the document is preserved in the output; otherwise, if this property is false, XmlDocument auto-indents the output.
Which makes me think that it needs to be set to false, to get auto indenting.
Christian Graus - Microsoft MVP - C++
-- modified at 22:58 Tuesday 6th September, 2005
|
|
|
|