|
In what language, for what purpose?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Double-click on it.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi,
I am trying to implement Apriori Algorithm(Mining Association Rules from XML Data) with XQuery. Unfortunately, I am not familiar with XQuery language. So, I need your help to fix the bug in the code given below
xquery version "1.0";
declare function apriori($l, $L, $minsup, $total, $src)
{
let $C := removeDuplicate(candidateGen($l))
let $l := getLargeItemsets($C, $minsup, $total, $src)
let $L := $l union $L
return if (empty($l)) then
$L
else
apriori($l, $L, $minsup, $total, $src)
}
let $src := doc(/transactions.xml)//items
let $minsup := 0.4
let $total := count($src) * 1.00
let $C := distinct-values($src/*)
let $l :=(for $itemset in $C
let $items := (for $item in $src/*
where $itemset = $item
return $item)
let $sup := (count($items) * 1.00) div $total
where $sup >= $minsup
return <largeItemset>
<items> {$itemset} </items>
<support> {$sup} </support>
</largeItemset>)
let $L := $l
return <largeItemsets> {apriori($l, $L,$minsup, $total, $src)}
</largeItemsets>
Error:
[DataDirect][XQuery][err:XPST0003]Error at line 14, column 1. Expected ";", but encountered "let"
Thanks for any help 
|
|
|
|
|
Hi,
My Sample XML is as follows:
<Students>
<Student>
<roll id="1" />
<StudName id="stud1" />
<Class1 val="cls1" />
<Class2 val="cls2" />
<Class3 val="cls3" />
<Class4 val="cls4" />
<Class5 val="cls5" />
<Class6 val="cls6" />
</Student>
<Student>
<roll id="2" />
<StudName id="stud2"/>
<Class1 val="cls7" />
<Class2 val="cls8" />
<Class3 val="cls9" />
<Class4 val="cls10" />
<Class5 val="cls11" />
<Class6 val="cls12" />
</Student>
<Student>
<roll id="3" />
<StudName id="stud3" />
<Class1 val="cls13" />
<Class2 val="cls14" />
<Class3 val="cls15" />
<Class4 val="cls16" />
<Class5 val="cls17" />
<Class6 val="cls18" />
</Student>
<Student>
<roll id="4" />
<StudName id="stud4" />
<Class1 val="cls19" />
<Class2 val="cls20" />
<Class3 val="cls21" />
<Class4 val="cls22" />
<Class5 val="cls23" />
<Class6 val="cls24" />
</Student>
<Student>
<roll id="5" />
<StudName id="stud5" />
<Class1 val="cls25" />
<Class2 val="cls26" />
<Class3 val="cls27" />
<Class4 val="cls28" />
<Class5 val="cls29" />
<Class6 val="cls30" />
</Student>
</Students>
Now i need to prepare XSLT such that if nodes are more than 3 then i need to get only roll and studname nodes.
I need to get the result as
<Students>
<Student>
<roll id="1" />
<StudName id="stud1" />
</Student>
<Student>
<roll id="2" />
<StudName id="stud2"/>
</Student>
<Student>
<roll id="3" />
<StudName id="stud3" />
</Student>
<Student>
<roll id="4" />
<StudName id="stud4" />
</Student>
<Student>
<roll id="5" />
<StudName id="stud5" />
</Student>
</Students>
Please provide me the required XSLT such that i need to get the above output...
Thanks in advance
Harini
|
|
|
|
|
I don't understand;
harinit wrote: if nodes are more than 3
From your input and output it looks as if you are doing nothing more than removing all the ClassX nodes.
Every man can tell how many goats or sheep he possesses, but not how many friends.
|
|
|
|
|
 Hi i am sorry for not explaining correctly...
My sample xml is as follows:
<Students>
<Student>
<roll id="1" />
<StudName id="stud1" />
<Class1 val="cls1" />
<Class2 val="cls2" />
<Class3 val="cls3" />
<Class4 val="cls4" />
<Class5 val="cls5" />
<Class6 val="cls6" />
</Student>
<Student>
<roll id="2" />
<StudName id="stud2"/>
<Class1 val="cls7" />
<Class2 val="cls8" />
<Class3 val="cls9" />
<Class4 val="cls10" />
<Class5 val="cls11" />
<Class6 val="cls12" />
</Student>
<Student>
<roll id="3" />
<StudName id="stud3" />
<Class1 val="cls13" />
<Class2 val="cls14" />
<Class3 val="cls15" />
<Class4 val="cls16" />
<Class5 val="cls17" />
<Class6 val="cls18" />
</Student>
<Student>
<roll id="4" />
<StudName id="stud4" />
<Class1 val="cls19" />
<Class2 val="cls20" />
<Class3 val="cls21" />
<Class4 val="cls22" />
<Class5 val="cls23" />
<Class6 val="cls24" />
</Student>
<Student>
<roll id="5" />
<StudName id="stud5" />
<Class1 val="cls25" />
<Class2 val="cls26" />
<Class3 val="cls27" />
<Class4 val="cls28" />
<Class5 val="cls29" />
<Class6 val="cls30" />
</Student>
</Students>
We need to get the length of xml node including child nodes.
Suppose if the length of xml exceeds the configured length then it should be formatted as small xml file with root elements.
Example: consider the <student> node(including child nodes) exceedes the length 100 then we should format the xml as given below using XSLT.
<Students>
<Student>
<roll id="1" />
<StudName id="stud1" />
<Class1 val="cls1" />
<Class2 val="cls2" />
<Class3 val="cls3" />
<Class4 val="cls4" />
<Class5 val="cls5" />
<Class6 val="cls6" />
</Student>
</Students>
<Students>
<Student>
<roll id="2" />
<StudName id="stud2"/>
<Class1 val="cls7" />
<Class2 val="cls8" />
<Class3 val="cls9" />
<Class4 val="cls10" />
<Class5 val="cls11" />
<Class6 val="cls12" />
</Student>
</Students>
|
|
|
|
|
="1.0"="utf-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="Students">
<Students>
<xsl:for-each select="*">
<xsl:choose>
<xsl:when test="count(./*) > 3">
<Student>
<xsl:copy-of select="roll"/>
<xsl:copy-of select="StudName"/>
</Student>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</Students>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
Dear readers,
for an xml-file I creat the corresponding schema-file (.xsd) in two ways: a) with VStudio and b) with the tool "xsd.exe"
Both results are in some way different. e.g. at data-types or at the label "minoccurs". It seems not to be so dramatic.
But, I use these schema-files for xmlmaps in excel, and here I have a dramatic impact. I get totally different behavior for both xsd-version.
Does anybody know, why both tools give a different result?
For my use-case, the VStudio-generated xsd is better, but how can I access is without Vstudio?
Thanks in advance
|
|
|
|
|
How do i check if a certain value exists?
For example, if my document looks like this:
<Systems>
<systemData>
<name>Name1</name>
<status>Active</status>
<slot>0</slot>
</systemData>
<systemData>
<name>Name2</name>
<status>Active</status>
<slot>1</slot>
</systemData>
</Systems>
how would i query the document to see if "Name1" exists?
|
|
|
|
|
Hi,
You can use XPath for this.
Below is a code snippet:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(@"C:\SystemX.xml");
string xPath = "/Systems/systemData[name='Name5']";
XmlNode xmlNode = xmlDoc.SelectSingleNode(xPath);
if (xmlNode == null)
{
MessageBox.Show("Name5 not found");
}
Hope this helps.
Good luck!
Integrity is telling myself the truth. And honesty is telling truth to other people.
My Blog![ ^]
|
|
|
|
|
XmlNode NodeItems = XMLdoc.SelectSingleNode("Systems/Systemdata/name");
NodeItem.InnerText will give you VALUE in particular node
|
|
|
|
|
Hello everyone,
I have an xml file name is questions.xml, I am checking these questions by using .xsd file but I need to load them in to jquery flipcard in order to show them on the html file, I will paste my questions.xml file here so could you please help me how to load these questions one by one using jquery flipcard and xml file?
questions.xml
Statement of Intent
Cut-off Claim
Indian Reserve
Treaty Right
Esquimalt & Nanaimo Railway
Fiduciary Duty
Douglas Treaties
Indian Act
Indian Reserve
Esquimalt & Nanaimo Railway
Band
Section 35
First Nation
Band Council
Statement of Intent
Cut-off Claim
Esquimalt & Nanaimo Railway
Fiduciary Duty
Statement of Intent
Cut-off Claim
Indian Reserve
Section 35
Indian Act
First Nation
Indian Reserve
Douglas Treaties
Band
Indian Act
Indian Reserve
Band
Fiduciary Duty
First Nation
First Nation
Statement of Intent
Band Council
Indian Reserve
Treaty Right
Statement of Intent
Treaty
Section 35
Cut-off Claim
Treaty Right
First Nation
Indian Reserve
Indian Act
Treaty
Band Council
Treaty Right
Section 35
Band
First Nation
Statement of Intent
Statement of Intent
Readiness
Interim Measures
INAC (Indian & Northern Affairs)
Interim Measures
First Nation
Main Table
Ministry of Aboriginal Affairs (MAA)
INAC (Indian & Northern Affairs)
Unity Protocol
Ministry of Aboriginal Affairs (MAA)
Readiness
Unity Protocol
British Columbia Treaty Commission (BCTC)
Hul'qumi'num Treaty Group
First Nations Summit
Hul'qumi'num Treaty Group
INAC (Indian & Northern Affairs)
British Columbia Treaty Commission (BCTC)
Third Parties
Unity Protocol
Main Table
Interim Measures
Hul'qumi'num Treaty Group
INAC (Indian & Northern Affairs)
Hul'qumi'num Treaty Group
Ministry of Aboriginal Affairs (MAA)
Unity Protocol
Hul'qumi'num Treaty Group
Third Parties
Ministry of Aboriginal Affairs (MAA)
Interim Measures
Main Table
British Columbia Treaty Commission (BCTC)
Unity Protocol
Hul'qumi'num Treaty Group
Ministry of Aboriginal Affairs (MAA)
Interim Measures
Third Parties
First Nations Summit
Framework Agreement
Land-based Jurisdictional Model
Land Tenure
RFiscal Arrangements
Aboriginal Rights
Expropriation
Treaty Mandates
Extinguishment
Aboriginal Title
Land-based Jurisdictional Model
Crown Grant
Expropriation
Aboriginal Rights
Land Tenure
Fiscal Arrangements
Treaty Mandates
Extinguishment
Aboriginal Rights
Framework Agreement
Expropriation
Land Tenure
Aboriginal Title
Extinguishment
Aboriginal Rights
Treaty Mandates
Land-based Jurisdictional Model
Expropriation
Extinguishment
Aboriginal Rights
Crown Grant
Treaty Mandates
Aboriginal Title
Land Tenure
Extinguishment
Aboriginal Title
Crown Grant
Aboriginal Title
Framework Agreement
Expropriation
Fiscal Arrangements
Overlaps
Crown Activity
Agreement in Principle (AIP)
Traditional Territory
Food Fish
Traditional Territory
Crown Tenure
Underlying Title
Food Fish
Crown Activity
Crown Tenure
Underlying Title
Traditional Territory
Crown Land
Food Fish
Land Quantum
Agreement in Principle (AIP)
Crown Tenure
Sub-surface
Underlying Title
Crown Activity
Traditional Territory
Crown Land
Sub-Surface
Sub-surface
Agreement in Principle (AIP)
Food Fish
Crown Activity
Food Fish
Traditional Territory
Crown Activity
Underlying Title
Crown Land
Land Quantum
Crown Tenure
Crown Activity
Overlaps
Crown Land
Sub-surface
Land Quantum
Final Agreement
Constitution
Expropriation
Indemnity
Expropriation
Citizenship Code
Eligibity
Compensation
Citizenship Code
Constitution
Compensation
Final Agreement
Eligibity
Self-Government
Citizenship Code
Indemnity
Compensation
Eligibity
Constitution
Final Agreement
Constitution
Final Agreement
Eligibity
Expropriation
Compensation
Final Agreement
Constitution
Citizenship Code
Citizenship Code
Constitution
Eligibity
Indemnity
Jurisdiction
Legal Uniformity
Implementation
Ratification
Resource-revenue Sharing
Ratification
Cooperative Management
Specific Claim
Financial Transfer Arrangements
Treaty Settlement Land
First Nations Roads
Legal Uniformity
Jurisdiction
Resource-revenue Sharing
Cooperative Management
Treaty Settlement Land
First Nations Roads
Resource-revenue Sharing
Capacity-building
Implementation
Treaty Settlement Land
Legal Uniformity
Resource-revenue Sharing
Cooperative Management
Treaty Settlement Land
Jurisdiction
Cooperative Management
Legal Uniformity
Ratification
Resource-revenue Sharing
Specific Claim
Financial Transfer Arrangements
Implementation
First Nations Roads
Financial Transfer Arrangements
Capacity-building
Treaty Settlement Land
Financial Transfer Arrangements
First Nations Roads
Cooperative Management
Resource-revenue Sharing
Financial Transfer Arrangements
Specific Claim
Jurisdiction
|
|
|
|
|
Hi Guys,
I am doing xslt transformation on a sample xmldoc using the xslt below. The problem I am having is its not matching on the 'Publication' tag. If I remove the namespace it works fine. Is there a way to get the match on the 'Publication' tag with the namespace in it?
Any help would be much appreciated,
Thanks.
----Sample XML------
="1.0"="utf-8"
<Publication xmlns="http://www.mycompany.com/Sampleproject/XmlSchema">
<PublicationDetails>
<AgencyId>1</AgencyId>
<PublicationId>PublicationId1</PublicationId>
<PublicationDateTime>1900-01-01T01:01:01-07:00</PublicationDateTime>
<OriginatingSystemName>OriginatingSystemName1</OriginatingSystemName>
<DestinationSystemName>DestinationSystemName1</DestinationSystemName>
</Publication>
---- Sample Xslt ------
="1.0"="utf-8"
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl: output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Publication">
<xsl:apply-templates select ="PublicationDetails"/>
</xsl:template>
<xsl:template match="PublicationDetails">
<SubmittingAgency>
</SubmittingAgency>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
I would like to convert the text data to uppercase and I wrote the expression as below
"/RawData/page/text[upper-case(.)='ABC']" its throwing an exception "XsltContext is needed for this query because of an unknown function"
Reference:
http://www.w3schools.com/xpath/xpath_functions.asp
a
|
|
|
|
|
problem solved with translate function.
textNode = docRawData.SelectSingleNode("/RawData/page/text[translate(text(),\"abcdefghijklmnopqrstuvwxyz\",\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")='" + rows[n].Trim() + "']");
|
|
|
|
|
Hi,
I'm trying to get the text element which contains value 1.345%, I tried as below to get the results. but the nodeList count is 0. please correct to get the correct results
XmlNodeList nodeList = rawData.SelectNodes("/RawData/page/text[.=<![CDATA[1.345%]]>");
If the value is simple text or integer, its working fine with the below code.
XmlNodeList nodeList = rawData.SelectNodes("/RawData/page/text[.='corporation'");
|
|
|
|
|
Both examples are missing a right square backet. If your second example works though then that wouldn't be the cause. But you should still fix it.
Instead the problem is that you can't treat CDATA like that. At least googling suggests you can't.
|
|
|
|
|
I just forgot to put right square bracket. what to do, to make it work with the value "10.5%" instead "corporation". Thanks in advance
XmlNodeList nodeList = rawData.SelectNodes("/RawData/page/text[.='corporation']");
|
|
|
|
|
I found that the problem is not with "%". The values is having extra spaces as " 10.34%"
So the below expression is not working.
"/Data/page/content[.='10.34%']".
its working with the expression "/Data/page/content[.=' 10.34%']".
Please guide me to solve this issue. Thanks in advance
<Data>
<page>
<content> 10.34%</content>
</page>
</Data>
|
|
|
|
|
Issued solved with the below expression
"/Data/page/content[normalize-space(.)='10.34%']".
|
|
|
|
|
Hello
I have question how can I put condition in my programming in windows phone application?
for example, if I want but code for help user when use my application the users cannot add number more than 80 in text box how I do it ?
Could you please help me !!!!
Kind regards 
|
|
|
|
|
Sounds like you are trying to add range validation to a textbox, but I doubt you are working with XML/XSL. See the forum list to find the forum appropriate for your question. Or you can ask a question in the general "Quick Answers" forum.
Martin Fowler wrote: Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
|
|
|
|
|
You could have posted this in a C# forum, you can get an answer much quciker than here. Make sure you are in the right place before posting a question.
Try this:
try
{
Int32 number = Int32.Parse(txtBoxId.Text);
if(number <= 80)
{
}
else
{
}
}
catch(Excemption e)
{
throw new Excemption("Not a valid interger!");
}
That's a basic function you need, you can call this function on your desired textbox events e.g. on onkeypress.
Hope this helps,
Morgs
|
|
|
|
|
|
Hi, I am having a problem in displaying XML in HTML as shown below -
XML:-
<ABC>
<DEF>
<GHI>Heading</GHI>
<P/> Hello, How are you?
<P/> I am a Developer.
</DEF>
</ABC>
XSLT:-
?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>
<h2>xml to html</h2>
<table border="0">
<xsl:for-each select="ABC/DEF">
<tr>
<td><xsl:value-of select="GHI" /></td><br/>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
OUTPUT -
Heading
HeadingHello, How are you?I am a Developer.
I want Heading to be in line 1 and then a line break and then comes paragraph. Also i want a space/line break between two paragraphs.
How to get following output instead -
Heading
Hello, How are you?
I am a Developer.
Thanks
Andyyy
|
|
|
|