|
I'm afraid I'm not convinced that because it is analysis, then it has no place in XSL. You could argue that any transformation is, when it comes down to it, an analysis activity. Why is any transformation performed? To allow the data to be output and therefore interpreted in a different way, which is simply another way of saying Analysis.
For example, a common activity is to list all the elements with a given attribute value. This in itself is a form of analysis.
|
|
|
|
|
|
How about something like this?
<xsl:variable name="mostCommonTime">
<xsl:for-each select="//fixtures/fixture">
<xsl:sort select="count(time)" order="descending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="count(time)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
modified on Wednesday, October 15, 2008 11:31 PM
|
|
|
|
|
Sorry to make my first post something like this, but i'm having one of those 'bang your head against the wall' problems, I usually work with t-sql and only use xml for outputs but today I have to parse a list in c# and output to html. I have had a search but I think as the xml i've been given is badly formed I've had little luck searching.
Anyway....
XML:
<data>
<person>
<name>peter jakes</name>
<path>pj87</path>
<property name="System">Linux</property>
<property name="Distro ID">Redhat</property>
</person>
</emucenter>
</data>
All, I want to do in xsl is display the text 'Linux' and 'Redhat' by using a name reference..
I can get this text if I use an ordinal number like so...
<xsl:value-of select="data/person/property[1]"/>
...this will display 'Linux', great. But I need to use the actual name reference not a number.
|
|
|
|
|
Once you have well formed XML rather than what you posted this XPath statement will return the property node in question
//data/person/property[@name='System']
A good reference for things like XPath is www.w3schools.com
good luck
led mike
|
|
|
|
|
thanks, I actually got there in the end, I did try w3schools first actually but they didn't have an example that fit how I wanted.
|
|
|
|
|
Consider this function:
BOOL GetSingleNodeV(const MSXML2::IXMLDOMDocumentPtr pXMLDoc, const CString &strPath, CString &StrValue)
{
BOOL bRetCode=FALSE;
BSTR bstrQstr = strPath.AllocSysString();
IXMLDOMNodePtr o;
o = pXMLDoc->selectSingleNode( bstrQstr);
if (o!=NULL)
{
HRESULT hr=o->get_text(&bstrQstr);
if (hr==S_OK)
{
StrValue = bstrQstr;
bRetCode = TRUE;
}
else
{
StrValue="";
}
}
//o->Release();
SysFreeString(bstrQstr);
return bRetCode;
}
Call to selectSingleNode() sometimes works as expected but sometimes it throws an exception. How can I extract additional information about this exception?
modified on Tuesday, September 30, 2008 1:52 PM
|
|
|
|
|
#import generated ATL code throws _com_error exceptions
When all else fails, consult the documentation[^]
led mike
|
|
|
|
|
Is possible to create an XmlDataSource that has 50 columns merge an sql database with 14 columns into and force the other 36 columns except and false or any value I want with c# or vb
Learning to Code
|
|
|
|
|
Ok. Pick a forum and stick with it. Posting the same question all over the site is considered rude.
|
|
|
|
|
Sorry, Just looking for help I am new.
Learning to Code
|
|
|
|
|
Hi All,
I have this XML files here:
<?xml version="1.0" encoding="utf-8">
<?xml-stylesheet type="text/xsl" href="TimesheetSQLScript.xsl"???>
<myfields>
<timesheetid>
<companycode>CCCRM</companycode>
<employee>Adrian</employee>
<weekpick>2008-09-15</weekpick>
<startdate>2008-09-15</startdate>
<note></note>
<enddate>2008-09-21</enddate>
<monday>
<mondate>2008-09-15</mondate>
<moncheck>
<moncheckin>14:10:00</moncheckin>
<moncheckout>15:44:00</moncheckout>
</moncheck>
<moncheck>
<moncheckin>16:44:00</moncheckin>
<moncheckout>22:50:00</moncheckout>
</moncheck>
</monday>
</timesheetid>
</myfields>
And I applied this XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8" />
<xsl:template match="/">
Declare @TimeCardID int
<xsl:apply-templates select="myFields/TimesheetID/Monday" />
</xsl:template>
<xsl:template match="Monday">
<xsl:text>set @TimeCardID = exec spCreateTimeCard '</xsl:text>
<xsl:value-of select="MonDate" />
<xsl:text>', '</xsl:text>
<xsl:value-of select="/myFields/TimesheetID/Employee" />
<xsl:text>'</xsl:text>
<xsl:for-each select="MonCheck">
exec spCreateTimeCardSession @TimeCardID, '
<xsl:value-of select="MonCheckIn" />
<xsl:text>', '</xsl:text>
<xsl:value-of select="MonCheckOut" />
<xsl:text>'</xsl:text>
</xsl:for-each>
</xsl:template>
It generate this sql statement:
Declare @TimeCardID int
set @TimeCardID = exec spCreateTimeCard '2008-09-15', 'Adrian'
exec spCreateTimeCardSession @TimeCardID, '
14:10:00', '15:44:00'
exec spCreateTimeCardSession @TimeCardID,
'16:44:00', '22:50:00'
but this is not what i want, is there a way that i can generate this statement like this:
Declare @TimeCardID int
set @TimeCardID = exec spCreateTimeCard '2008-09-15', 'Adrian'
exec spCreateTimeCardSession @TimeCardID, '14:10:00', '15:44:00'
exec spCreateTimeCardSession @TimeCardID, '16:44:00', '22:50:00'
Thanks in advance </xsl:stylesheet>
|
|
|
|
|
don't worry folks, i fixed by myself. just have to put <xsl:text></xsl:text> tags like this:
exec spCreateTimeCardSession @TimeCardID, '<xsl:text></xsl:text>
|
|
|
|
|
How can I create a schema for the following?
<Data>
<Value unit="m/s">10</Value>
<Value unit="ºF">25</Value>
</Data>
I would like to have the following description in the xsd
<xs:complexType name="rootSchema">
<xs:sequence>
<xs:element name="Value" type="valueSchema" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:element name="Multicalc" type="rootSchema" />
How do I write the definition of valueSchema?
(I hope I didn't make any mistakes in the definitions. I simplified things a bit compared to my own xsd.)
|
|
|
|
|
see if this works
<xs:complexType name="valueSchema">
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="unit" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
led mike
|
|
|
|
|
Thanks a bunch. It did the trick it seems.
|
|
|
|
|
I want to add rss feed into the html page, but I have a problem. When I displayed the xml file with xsl. It only works at IE, but doesn't work at Firefox.
Tell me why? Thanks.
|
|
|
|
|
josseph.zhang wrote: When I displayed the xml file with xsl. It only works at IE, but doesn't work at Firefox.
Tell me why?
You need to explain this in more detail:
josseph.zhang wrote: I displayed the xml file with xsl
led mike
|
|
|
|
|
I am assuming you are using the Style Sheet Processing Instruction,
<?xml-stylesheet type="text/xsl" href="filename.xslt"?><br /> . Not all browsers (especially their older versions) are able to transform XML using this Processing Instruction. However, the following link may be helpful: http://www.ibm.com/developerworks/web/library/x-think40/[^].
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Yes, you are clever.I used it.The link given is very useful to me. Thanks a lot.
|
|
|
|
|
All
I have a web service that has been working fine until yesterday evening, I don't remember making any changes, but for some reason since yesterday evening I am getting the message "WSE910: An error happened during the processing of a response message, and you can find the error in the inner exception. You can also find the response message in the Response property." with inner exception as "Root Element Missing". I checked the xml file generated and can't find anything mistakes in it. I am using the same machine as client/server so there is no point of time difference.
Appreciate your help
Sri
|
|
|
|
|
Srikant Talasila wrote: I am using the same machine as client/server so there is no point of time difference.
What does "no point of time difference" mean?
led mike
|
|
|
|
|
Do you know what a Root Element is?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
I have a problem, I must create an XML document from Excel, but I don't know how to setup two primary nodes. XML document has this format
<?xml version="1.0" encoding="UTF-8" ?>
- <EasyfattProducts AppVersion="DaneaEasyfatt.2006.17.00">
- <Products>
- <Product>
<InternalID>1</InternalID>
<Code>xxx</Code>
<Description>xxx</Description>
</Product>
</Products>
</EasyfattProducts>
I'm using a project of Raymond Pang that I downloaded in this web-site.
Help me please!
Excuseme for my bad english!
|
|
|
|
|
izzy87 wrote: but I don't know how to setup two primary nodes.
That does not explain your problem. Maybe you should try again, and remember, we cannot read your mind.
led mike
|
|
|
|