Click here to Skip to main content
       

XML / XSL

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
QuestionXml Schema [modified]memberVijjuuu.14 Jun '12 - 7:02 
Hi All,
 
I am trying to create Schema file for xml which looks like a General tree.
 
My xml will look like
 
<root>
 
 <node name = "" >
   <leaf name = "" value = "" />
 </node>
 

</root>
A node can contain any number of node inside and it goes on.
 
like
 
<root>
 
 <node name = "" >
   <leaf name = "" value = "" />
 </node>
 
<node name = "" >
   <node name = "" >
      <leaf name = "" value = "" />
           <node name = "" >
              <leaf name = "" value = "" />
           </node>
  </node>
</node>
 
</root>
 
Please advice how to create xsd file.
 
Thanks.

modified 14 Jun '12 - 13:47.

AnswerRe: Xml SchemamvpSandeep Mewara14 Jun '12 - 10:49 
Following should help you:
Generate XSD from XML[^]
MSDN: XML Schema Definition Tool (Xsd.exe) [^]
 
Try out!

GeneralRe: Xml SchemamemberVijjuuu.14 Jun '12 - 18:49 
Thanks for your reply.
i was looking for generic xsd not for specific scenario.
 
i have general Tree having a node which contains some data.
GeneralRe: Xml SchemamvpSandeep Mewara14 Jun '12 - 20:48 
Above example links were not shared for any specific example. They are for generic design. Reference to start up with.
 
Don't say, you are expecting an XSD design for your particular tree scenario from us directly!

GeneralRe: Xml SchemamemberVijjuuu.15 Jun '12 - 7:55 
Thanks that will be enough.
QuestionPerformance issue in XSL processingmemberpraveen3g8 Jun '12 - 21:30 
Hi All,
 
Feels good to be a part of this forum of technical stalwarts and Gurus. I feel I will get a solution for my long time problem here .
 
The problem we are facing here is the performance issues when processing the large XML files. Using Java API transformer factory in interpretive mode takes unbelievable 6 days for processing huge files which is a point of very serious concern in a production system.
 
Please help me out and do let me know what are the different things required to be attached which will be helpful for the analysis.
AnswerRe: Performance issue in XSL processingmvpRichard MacCutchan8 Jun '12 - 22:12 
praveen3g wrote:
takes unbelievable 6 days for processing huge files

Most people would have figured there was something wrong before this. Take a look at the data you are processing and how you are dealing with it. The chances of anyone being able to guess what is wrong is not very high.

GeneralRe: Performance issue in XSL processingmemberpraveen3g8 Jun '12 - 22:26 
Hi,
 
Thanks for the reply.
 
Answer is no , to the people whom I have checked with was not able to diagnose where the problem is and what is the way around it. Everyone definitely understand that the volume of data in the file is huge , say 100MB xml document but no one till data have given a way to work around it efficiently. Let me know if you wish to have a glance and will look forward to your suggestions
GeneralRe: Performance issue in XSL processingmvpRichard MacCutchan8 Jun '12 - 22:40 
This is not the sort of issue that can be resolved in a forum like this. You need to do some analysis of your code and measuring of your processing time and code paths. Try running against some small data files and see how long it takes and try to work out whether that is an acceptable length of time.

GeneralRe: Performance issue in XSL processingmemberpraveen3g8 Jun '12 - 23:04 
I have done my analysis and I guess you do not understand actually what the issue is.Do understand am not a kinder garden student to just post a question and expect a ready made answer as I have done quite a lot of research in it more than you . I will look for someone who can just help me out on what are the different parameters that can be looked for rather than just replying generic. Please do not bother to reply further. Thanks again.
GeneralRe: Performance issue in XSL processingmvpRichard MacCutchan8 Jun '12 - 23:10 
praveen3g wrote:
you do not understand actually what the issue is.

Yes, I understand perfectly: your code runs slow and you want to know why.
 
praveen3g wrote:
I will look for someone who can just help me out on what are the different parameters that can be looked for rather than just replying generic.

Given the information you have provided how can anyone guess what those parameters are?

GeneralRe: Performance issue in XSL processingmemberpraveen3g8 Jun '12 - 23:15 
I have asked specifically what sort of information I should update here which is required for your analysis as I don't know what logs, JVM settings , XSL snippets which is taking more memory and time you may require for your analysis.If you have asked me any one of the above details or whatever you think is required, I can definitely provide them at first place.
GeneralRe: Performance issue in XSL processingmvpRichard MacCutchan8 Jun '12 - 23:32 
praveen3g wrote:
you may require for your analysis.

Like most people on this forum, I do not have the time or resources to analyse an issue like this. As I said earlier this question cannot be answered in a forum such as this. You need to do the analysis and ask a more specific and detailed question before anyone can hope to offer any suggestions.

GeneralRe: Performance issue in XSL processingmemberpraveen3g9 Jun '12 - 0:07 
I have done my part of analysis and even know where it is taking time.
 
So I am left with 2 options
1) Splitting the large XML file to small chunk of files based on a condition.
2) Increasing the DTM threads in Java API so that compiled version of Xalan can be used.
 
Let me know if you have any ideas in one of the options above. I can ask questions to the point on the option you say
GeneralRe: Performance issue in XSL processingmemberSasha Laurel18 Jul '12 - 13:11 
Have you tried using a profiler? A colleague of mine wrote an xml parser/validator in .Net for large files and the first file would complete in about 20-30 minutes. After the first though, it would get incredibly slow, taking around 18-30 hours to process 50mb files. When we checked the memory allocations there were about 10 times more than necessary. The app was running out of memory and continually hitting the page file on disk to make up the difference. All of that because he didn't understand the immutable nature of .Net Strings.
 
EDIT - I realize you are not using .Net, but I am thinking you could try a profiler for java.
 
That is the best advice I can give, good luck friend. Smile | :)
QuestionA way to view and edit a xml file in the web browsermemberMember 879241431 May '12 - 4:17 
I have a program I have written that displays the contents of a xml file in a browser.   I am trying to make it more user friendly for people to change the xml files without opening them in notepad or a canned xml editor.   What I would like to do is be able to pull the information from the xml file into a webpage and allow the users to make changes and save it back to the xml file.   I've done google searches for about a week and can't come up with a good way to do it.   Any suggestions would be much appreciated.
AnswerRe: A way to view and edit a xml file in the web browsermemberMember 85887647 Jun '12 - 19:30 
I'm doing one currently where the xml is shown in the browser control (after xslt applied to it) and if the user needs to add data (we are not changing anything)I have a form come up to fill in the data. This was the most direct method for me but if that doesn't work you may have to look in the javascript direction.
AnswerRe: A way to view and edit a xml file in the web browsermemberGer Hayden22 Jul '12 - 8:24 
Marc Clifton has a good article here where he parses the schema, and produces a dialog based form showing the message content. Well worth a look.
Ger

Questiona free xml tool to acquire xpathmemberQinbo ZHOU29 May '12 - 19:38 
Is there any free xml tool to acquire xpath value of some element or attribute?
thanks!
QuestionXML Schema problem [modified]memberThe_Infinite26 Apr '12 - 23:42 
Hello. Im trying to create an xml schema that can capture the following behavior:
 
1. <info> element should be the first inside <root>
2. <ParamA>, <ParamB>, <ParamC>, <ParamD>, and <ParamE> are optional, should appear after the <info> element and can appear in any order.
 
The following xml are valid:
 
<root>
  <info></info>
  <ParamA></ParamA>
  <ParamB></ParamB>
  <ParamC></ParamC>
  <ParamD></ParamD>
  <ParamE></ParamE>
</root>
 
OR
 
<root>
  <info></info>
  <ParamB></ParamB><!--Interchangeable with other Param-->
  <ParamD></ParamD><!--Interchangeable with other Param-->
  <ParamC></ParamC><!--Interchangeable with other Param-->
  <ParamA></ParamA><!--Interchangeable with other Param-->
  <ParamE></ParamE><!--Interchangeable with other Param-->
</root>
 
The following xml is NOT valid:
<root>
  <ParamB></ParamB>
  <ParamD></ParamD>
  <ParamC></ParamC>
  <ParamA></ParamA>
  <info></info> <!--This should appear as the first element inside root-->
  <ParamE></ParamE>
</root>
 
I have tried doing:
<xs:sequence>
  <xs:element name="info" minOccurrence="0">
  <xs:all>
    <xs:element name="ParamA" minOccurrence="0">
    <xs:element name="ParamB" minOccurrence="0">
    <xs:element name="ParamC" minOccurrence="0">
    <xs:element name="ParamD" minOccurrence="0">
    <xs:element name="ParamE" minOccurrence="0">
  </xs:all>
</xs:sequence>
This causes an invalid xml schema error because an all model group is not allowed to appear inside another model group.
 
I've also tried substitution:
<xs:complexType name="information">
  <xs:all>
    <xs:element name="info" minOccurrence="0">
  </xs:all>
</xs:complexType>
 
<xs:complexType>
  <xs:complexContent>
    <xs:extension base="information">
      <xs:all>
        <xs:element name="ParamA" minOccurrence="0">
        <xs:element name="ParamB" minOccurrence="0">
        <xs:element name="ParamC" minOccurrence="0">
        <xs:element name="ParamD" minOccurrence="0">
        <xs:element name="ParamE" minOccurrence="0">
      </xs:all>
    </xs:extension>
  </xs:complexContent>  
</xs:complexType>
This is still getting an xml schema error on the usage of all model group.
 
Does anyone have a similar problem or have any idea how to create an xml schema for the desired behavior stated above? Thanks.

modified 27 Apr '12 - 5:56.

AnswerRe: XML Schema problemmemberMember 794572714 May '12 - 3:22 
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
     
      <xs:element name="root">
            <xs:complexType>
                  <xs:sequence>
                        <xs:element name="info" maxOccurs="unbounded" minOccurs="1">
                              <xs:complexType>
                                    <xs:all>
                                          <xs:element ref="paramA" maxOccurs="1" minOccurs="1"/>
                                          <xs:element ref="paramB" maxOccurs="1" minOccurs="1"/>
                                          <xs:element ref="paramC" maxOccurs="1" minOccurs="1"/>
                                          <xs:element ref="paramD" maxOccurs="1" minOccurs="1"/>
                                          <xs:element ref="paramE" maxOccurs="1" minOccurs="1"/>
                                    </xs:all>
                              </xs:complexType>
                        </xs:element>
                  </xs:sequence>
            </xs:complexType>
      </xs:element>
     
      <xs:element name="paramA" type="xs:string"/>
      <xs:element name="paramB" type="xs:string"/>
      <xs:element name="paramC" type="xs:string"/>
      <xs:element name="paramD" type="xs:string"/>
      <xs:element name="paramE" type="xs:string"/>
 
</xs:schema>
QuestionRemove a XMLnode - Pls helpmemberharvid24 Apr '12 - 18:24 
Hello,
 
Below is my XML document.
 
         <GetCountersResult>
                  <GetCountsResult xmlns="">
                     <Count>
                           <ID>FP108MR</ID>
                           <Value>0</Value>
                           <Part>Z9999</Part>
                     </Count>
                  </GetCountsResult>
            </GetCountersResult>
 
I need to remove only <GetCountsResult> node so that my xml document remains as below.
 

            <GetCountersResult>
                     <Count>
                           <ID>FP108MR</ID>
                           <Value>0</Value>
                           <Part>Z9999</Part>
                     </Count>
            </GetCountersResult>
 

I used the following code to convert Dataset to a XMLdocument.
 
Dim dtCounter As New DataSet("GetCountsResult")
oDatabase.Connect()
 
oDatabase.PopulateDataSet("Count", "Get_Current_Counter", True, dtCounter)
 
Dim sw As New StringWriter    
dtCounter.WriteXml(sw, XmlWriteMode.IgnoreSchema)
Dim xmldoc As New XmlDocument
xmldoc.LoadXml(sw.ToString())
 
Please help me in getting this.
 
Thanks.
AnswerRe: Remove a XMLnode - Pls help [modified]memberVJ Reddy24 Apr '12 - 22:02 
The ReplaceChild method of XmlNodeclass explained here http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.replacechild.aspx[^] can be used for replacing the desired nodes as shown below:
void Main()
{
    string xmlCounters =
    @"<GetCountersResult>
          <GetCountsResult xmlns="""">
             <Count>
                   <ID>FP108MR</ID>
                   <Value>0</Value>
                   <Part>Z9999</Part>
             </Count>
          </GetCountsResult>
          <GetCountsResult xmlns="""">
             <Count>
                   <ID>FP108MR No2</ID>
                   <Value>0 No2</Value>
                   <Part>Z9999 No2</Part>
             </Count>
          </GetCountsResult>
    </GetCountersResult>";
 
    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.LoadXml(xmlCounters);
    var countNodes = xmlDoc.GetElementsByTagName("Count");
    //foreach throws, the element list has changed, error
    for (int i=0; i < countNodes.Count; i++)
    {
        xmlDoc.DocumentElement.ReplaceChild(countNodes[i], countNodes[i].ParentNode);
    }
    string fileName = @"F:\ModifiedXml.xml";
    xmlDoc.Save(fileName);
}
 
//The contents of file

//  <GetCountersResult>
//      <Count>
//          <ID>FP108MR</ID>
//          <Value>0</Value>
//          <Part>Z9999</Part>
//      </Count>
//      <Count>
//          <ID>FP108MR No2</ID>
//          <Value>0 No2</Value>
//          <Part>Z9999 No2</Part>
//      </Count>
//  </GetCountersResult>


modified 25 Apr '12 - 4:34.

GeneralRe: Remove a XMLnode - Pls helpmemberharvid24 Apr '12 - 22:59 
Thank you so much. I will try this.
GeneralRe: Remove a XMLnode - Pls helpmemberVJ Reddy24 Apr '12 - 23:17 
You're welcome. After trying please give your feedback and if it is helpful you may consider to vote.
Thank you for the response.
GeneralHow to specify a Hex value in XML? [modified]memberFrank W. Wu9 Apr '12 - 11:47 
I have an integer attribute declared in the xsd file. In the xml file, I need to use hex for the value. I can’t find info about the syntax about hex value. 
I tried something but neither
<MyData MyValue="0x52590"/> nor <MyData MyValue="#52590"/> works. Any clues are appreciated.


modified 10 Apr '12 - 9:38.

AnswerRe: How to specify a Hex value in XML?memberPJ Arends9 Apr '12 - 16:09 
<MyData MyValue="0x52590"/>
Independent ACN Business Owner

Make toll free long distance calls from your smart phone with ACN Mobile World.
When connected via wifi, calls will not use any of your minutes or data, nor will there be any roaming charges.
Certain conditions apply. See my website for details.


Within you lies the power for good - Use it!




GeneralRe: How to specify a Hex value in XML?memberjschell10 Apr '12 - 8:48 
Frank W. Wu wrote:
I have an integer attribute declared in the xsd file. In the xml file, I need to use hex for the value. I can’t find info about the syntax about hex value.

 
Because that isn't possible.
 
Definition of an 'int' is a optional sign followed by decimal digits. Nothing else.
 
The definition.
 
http://www.w3.org/TR/xmlschema-2/#int[^]
 
In terms of a solution - convert the hex value to an integer or change the xsd.
QuestionWhat is it called?memberPJ Arends7 Apr '12 - 21:32 
In this[^] article, the author uses two notations to access elements in an XML DOM object
Element elem1 = root[L"aa|bb|cc"]
and
Element elem1 = root[L"aa"][L"bb"][L"cc"]
Is there a name for these two different notations, and if so what are they?
Independent ACN Business Owner

Make toll free long distance calls from your smart phone with ACN Mobile World.
When connected via wifi, calls will not use any of your minutes or data, nor will there be any roaming charges.
Certain conditions apply. See my website for details.


Within you lies the power for good - Use it!




QuestionGetting values with templatemembermemorexr24 Mar '12 - 4:48 
I'm having next xml file and I want to make an xsl template to select the name of node that containts some values for child nodes.
 
xml:
 
<pre lang="HTML">
<nodes>
 <n1>
   <name>AA</name>
   <fields>
    <field1>a</field>
    <field2>b</field>
    <field3>c</field>
   </fields>
 </n1>
 
 <n2>
   <name>BB</name>
   <fields>
    <field1>a</field>
    <field2>x</field>
    <field3>c</field>
   </fields>
 </n2>
 
 <n3>
   <name>BB</name>
    <fields>
    <field2>x</field>
    <field3>c</field>
   </fields>
 </n3>
</nodes>
 
I want to get only the nodes that have at fields a and not b (a and !b), so every fields node can have a variable number of childs. In this example it will be valid only n2
AnswerRe: Getting values with templatememberPIEBALDconsult26 Mar '12 - 8:21 
The XML you posted is mal-formed, but after cleaning it up a little I found that
 
"*/*[fields/*='a' and not(fields/*='b')]"
 
seems to work.
QuestionXmlDocument.SelectNodes not working for namespace attributes [modified]memberPIEBALDconsult23 Mar '12 - 12:23 
I'm trying to iterate the namespace declarations in an XML document so I can add them to the XmlNamespaceManager, but it's not working.
 
Given an XML document like:
 
<foo:bar xmlns:foo='the URI for foo' />
 
I expect:
 
System.Xml.XmlDocument doc = new System.Xml.XmlDocument() ;
 
doc.Load ( args [ 0 ] ) ;
 
System.Xml.XmlNamespaceManager mgr = new System.Xml.XmlNamespaceManager ( doc.NameTable ) ;
 
foreach ( System.Xml.XmlNode nod in doc.SelectNodes ( "//*[@xmlns:*]" , mgr ) )
...
 
to select that element, but it doesn't.
 
Am I missing something? Does SelectNodes just not want to select by namespace attributes?
 

Edit: I now see that this is the defined behaviour of XPath 1.0; I don't like it, but there it is.

modified 29 Mar '12 - 18:00.

AnswerRe: XmlDocument.SelectNodes not working for namespace attributesmemberwoopsydoozy26 Mar '12 - 11:08 
Kinda sounds like you're putting the cart before the horse. You're trying to walk the document to select the namespaces, but in order to walk the tree with xpaths, you really need the namespaces first. Do you not know the structure of your XML? You're really supposed to know your namespaces first, and just use them.
 
You can, I think, walk the tree through the object model and pull out the namespace prefixes and URIs--using some combination of the NamespaceURI property, and the GetNamespaceOfPrefix and/or GetPrefixOfNamespace methods. There's probably a much more efficient way, though--maybe the XMLReader? Quick search .. try this:
http://www.hanselman.com/blog/GetNamespacesFromAnXMLDocumentWithXPathDocumentAndLINQToXML.aspx[^]
GeneralRe: XmlDocument.SelectNodes not working for namespace attributesmemberPIEBALDconsult26 Mar '12 - 16:52 
woopsydoozy wrote:
Do you not know the structure of your XML?

 
Correct.
 

woopsydoozy wrote:
in order to walk the tree with xpaths, you really need the namespaces

 
I know the one for xmlns, and it's in the manager, but I can't use it.
 

I'll read the suggested page. Thanks.
GeneralRe: XmlDocument.SelectNodes not working for namespace attributesmemberPIEBALDconsult28 Mar '12 - 5:26 
Having read the suggested page and tried a few more things I now understand a lot more about the problems I'm having, but it still doesn't explain why I can't use SelectNodes to get the information I need.
GeneralRe: XmlDocument.SelectNodes not working for namespace attributesmemberwoopsydoozy28 Mar '12 - 5:53 
Is your issue maybe in using the namespace in the xpath? In your original XML snippet, for example, if you wanted the "box" element in the foo namespace, you'd select foo:box. You do have to add the "foo" namespace to your manager to use it, though:
mgr.AddNamespace("foo","the URI for foo")
Just declaring a namespacemanager does not automatically load all the namespaces.
 
When it's a default namespace (no prefix), the trick I've used in the past is to add a new namespace that has the same URI:
mgr.AddNamespace("foo2","the URI for foo")
This allows me to query for foo2:box.
 
Or maybe you're just wondering why you can't query using xmlns as an attribute? I don't know the technical answer except that it's special somehow, not available as a standard attribute. You can still access it in xpath/xslt if you need to--check out the namespace-uri method, for example.
GeneralRe: XmlDocument.SelectNodes not working for namespace attributes [modified]memberPIEBALDconsult28 Mar '12 - 10:24 
woopsydoozy wrote:
Is your issue maybe in using the namespace in the xpath?

 
No, I got that now.
 

woopsydoozy wrote:
Just declaring a namespacemanager does not automatically load all the namespaces

 
Right, and now I understand why. I hope to write at least a Tip on it soon.
 

woopsydoozy wrote:
When it's a default namespace ...

 
Right, even though it seems bogus (I still need to investigate further).
 
Edit: The W3C spec for XPath 1.0 (section 2.3 Node tests) says in part:
"
A QName in the node test is expanded into an expanded-name using the namespace declarations from the expression context. This is the same way expansion is done for element type names in start and end-tags except that the default namespace declared with xmlns is not used: if the QName does not have a prefix, then the namespace URI is null (this is the same way attribute names are expanded).
"
http://www.w3.org/TR/xpath/#node-tests[^]
 
So it's W3C's fault and I still don't see why they would define it that way. :mad:

 
woopsydoozy wrote:
maybe you're just wondering why you can't query using xmlns as an attribute

 
Yes, and also as the namespace of an attribute.
 

Edit: The W3C spec for XPath 1.0 (section 5.3 Attribute Nodes) says in part:
"
There are no attribute nodes corresponding to attributes that declare namespaces
"


modified 29 Mar '12 - 17:22.

GeneralRe: XmlDocument.SelectNodes not working for namespace attributesmemberwoopsydoozy28 Mar '12 - 10:52 
Michael Kay rocks (check out his books, if you're doing anything with XSLT): http://www.stylusstudio.com/xsllist/200403/post30310.html
 
And attributes don't inherit the namespaces of their containing element by default. They only have namespaces if they have their own namespace prefix (which I don't think I've ever seen in practice). So if you had this XML:
<demo xmlns:foo='foo URI'><foo:box contents='zombie cat'/></demo>
and you wanted to find out what was in the box, you'd add foo and its URI to your namespace manager and get /demo/foo:box/@contents. Only with this XML:
<demo xmlns:foo='foo URI'><foo:box foo:contents='zombie cat'/></demo>
would you need to specify the attribute's namespace: /demo/foo:box/@foo:contents.
GeneralRe: XmlDocument.SelectNodes not working for namespace attributesmemberPIEBALDconsult28 Mar '12 - 18:14 
Thanks, I'll have to look into some books.
 
The rest of that I understand, but it still remains that when there's a namespace attribute, like:
 
<foo:bar xmlns:foo='foo' />
 
I can't select it even though the namespace is in the manager.
 
I really suspect that MS made some controversial choices in implementing System.Xml.XPath.XPathNavigator.Select when it comes to the default namespace and the xmlns namespace. So I may have to implement my own and I don't look forward to it.
QuestionXPath query to return nodes based on a range within an attribute's value.memberBill.Moo13 Mar '12 - 6:21 
Hello All,
 
I want to return a set of nodes where the value of my ID attribute falls within a specified range. i.e. if I have 200 elements with each elements' ID being sequential I would like to return N of them where the @ID >= X and @ID <= Y. But regardless of how I try to do this I end up with nothing! For example :
/element[@ID >= '44' and following-sibling[@ID <= '50']
Ideally this would return 6 elements but I get nothing, nor does :
/input[@ID >= '44' and following-sibling[@ID <= '50']]
 
I would appreciate your help on this please, it's driving me to distraction.
--
Moo

AnswerRe: XPath query to return nodes based on a range within an attribute's value.memberwoopsydoozy16 Mar '12 - 7:43 
you're over-thinking it:
element[@ID >= '44' and @ID <= '50']

GeneralRe: XPath query to return nodes based on a range within an attribute's value.memberBill.Moo19 Mar '12 - 6:18 
Of course! Thank you.
--
Moo

Questionreconfirmmembersantoshkumar11876 Mar '12 - 7:06 
hello
AnswerRe: reconfirmmemberChandrasekharan P9 Apr '12 - 21:02 
Validation failed!!!
 

"GET OUT OF HERE" was the message
Every new day is another chance to change your life.

Questionxml data will not display on the screen on a php pagememberawolarczuk1 Mar '12 - 0:05 
Hi all
I have a php page with is connected to a xml file to display the data, for some reason this data will not display it will only dispplay the header and footer, i have worked out there has to be something wrong with the products.php as when i use a problem called xlm notepad and open the xml and attach the XLST or XLS it will display in the text window
 
if someone could please tell me how to get this fixed as i need to get it fixed asap
 
here is the code for the product.php
 
<!-- 
  Adby Designs
  By Adam Wolarczuk
  Aug 2011
-->
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
 
<html lang="en">
 
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Products - Australian Financial and Mortgage Services </title>
		
		<meta http-equiv="content-script-type" content="text/javascript" >
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" >
		<link href="settings.css" rel="stylesheet" type="text/css">
 

</head>
 
<body>
	<div id="container"><!-- Top of the page and page location -->
		
		<div id= "ptitle">PRODUCTS AND SERVICES</div>
		
		<?php include("menu.php"); ?>
		
		<?php
 
	 // $product = $_GET['product']
			// (use '//' to comment out a single line)
	
				  $xp = new XsltProcessor();
				 // $product = $_GET['product']
				
				  $xsl = new DomDocument;
				  $xsl->load('products.xsl');
				  
				  $xp->importStylesheet($xsl);
				  
				  $xml_doc = new DomDocument;
				  $xml_doc->load('products.xml');
				
				  $xp->setParameter('', 'product', 1);
				 
				      if ($html = $xp->transformToXML($xml_doc)) {
				      echo $html;
				  } else {
				      trigger_error('XSL transformation failed.', E_USER_ERROR);
  }			   ?>
		
		
		<!-- *****This is for the bottom table links****-->
		
			<?php include("footer.php"); ?>
 
		<!--**** This is for the bottom table links***-->
 
	<!-- Bottom  of the page and page location -->
  
    
    </div>
 

</body>
 
</html>
 
this is the code for the products.xml
 
<products>
    <product cat-ref="HL" id="HL01">
        <title lang="en">Standard Variable</title>
        <Description>
            <p>
            	"Standard Variable"
            	A standard variable loan offers the customer freedom of choice with complete
                repayment flexibility and a full range of features. <br/> The interest rate on these
                types of loans fluctuates (up or down) as interest rates change in our financial
                markets.</p>
 
           
          <list type="numbered">
                <list-intro>There are additional benefits associated with a standard variable
                    loan:</list-intro>
 
                <list-item>Flexibility to choose between interest only repayments or principal and
                    interest repayments.</list-item>
                <list-item>Redraw facility is available and you can utilise this option to redraw
                    payments already made in advance.</list-item>
                <list-item>You can have a partial or 100% interest offset facility attached to your
                    loan when the loan includes repayments for principal and interest. Interest
                    offset is not available on interest only loans.</list-item>
                <list-item>Principal reduction may be made at any time without attracting additional
                    fees.</list-item>
                <list-item>You also have the option of taking the loan over a maximum of 30 years
                    but you can opt to repay your loan in full within a shorter period of time
                    without attracting additional penalty charges.</list-item>
                <list-item>Clients can make as many additional payments to their standard variable
                    loan as they wish.</list-item>
            </list>          
 
            <p>It is important to note that lenders may have other associated costs to cover
                administration fees. Our consultants can compare these facilities and ensure that
                the appropriate loan structure is put in place to help you achieve your financial
                needs.<br/></p>
        </Description>
    </product>
    <product cat-ref="HL" id="HL02">
        <title lang="en">Basic Variable</title>
        <Description>
			Basic Variable
            <p>Basic variable rate loans are sometimes referred to as the 'no frills' alternative to the standard 
			variable rate loans. The interest rate is lower than a standard variable loan, making them attractive 
			to the budget conscious borrower. It offers a lower variable rate but with fewer features. These loans 
			normally have no ongoing fees associated with it.</p>
        </Description>
    </product>
	
	  <product cat-ref="HL" id="HL03">
        <title lang="en">Introductory (Honeymoon)</title>
        <Description>
            Introductory (Honeymoon)
	
			<p>An Introductory Variable Rate loan generally offers a guaranteed low rate for an initial period of 
			time (usually 12 months) after which most interest rates will revert to the Standard Variable Rate.
			It is Ideal for those wishing to take advantage of lower initial repayments.</p>
        </Description>
    </product>
	
		  <product cat-ref="HL" id="HL04">
        <title lang="en">Fixed Rate Loan</title>
        <Description>
            Fixed Rate Loan
	
			<p>Fixed rate loans are funds lent over a set term at a set interest rate. This gives the borrower 
			the certainty of knowing exactly what their monthly repayments will be should their circumstances change. 
			Some lenders may impose early repayment penalties if you make a lump sum reduction to your loan or you pay 
			the loan out in full. However, a fixed rate loan is ideal in a rising interest rate market as this guarantees
			you of your interest rate and repayments for a set time.</p>
        </Description>
    </product>
	
		  <product cat-ref="HL" id="HL05">
        <title lang="en">Refinancing</title>
        <Description>
            Refinancing
	
			<p>Mortgage refinancing is a process of renegotiating your original mortgage agreement. </p>
 
			<p>With the lending sector constantly changing and lenders constantly enhancing their products to attract new customers, existing customers are left behind, often with products that are no longer as well placed in the market as they once were. It is always important to keep an eye on how your mortgage stacks up against current market leaders and having a mortgage broker can simplify this for you.</p>
 
			<p>While there are inherent costs in altering your existing mortgage you must compare these to the savings made over the entire term of your loan.</p>
        </Description>
    </product>
    
     <product cat-ref="HL" id="HL06">
        <title lang="en">Bridging Loan</title>
        <Description>
            Bridging Loan
	
			<p>A Bridging Loan is available to borrowers who wish to purchase a new home now and sell your current home later. 
			These loans are especially helpful to 'bridge' the gap between the sale of one property and the purchase of another.
			 The interest rate on a Bridging Home Loan is usually the same as a Standard Variable Rate Loan. A Bridging Loan ensures 
			 that the borrower will not miss out on a desired property because they haven't sold the current home</p>
        </Description>
    </product>
 

 
    <product cat-ref="NCL" id="NCL02">
        <title lang="en">Credit Impaired</title>
        <Description>
            <p>Low Documentation (or No documentation) loans are designed for the self-employed or small company borrower whose financial statements may not be available for many different reasons (eg Accountant hasn't completed their financials). The borrower must have a sizeable deposit or equity in existing real estate property. Generally, most lenders lend a maximum of 80% of the property value with mortgage insurance applying above 60%.</p>
 
			<p>These loans are usually a variable rate and offer most of the features and benefits attached to the lender's standard variable rate loan product. A Low Document Loan can be just as competitive as a full documentation loan, however they provide less hassle as the borrower doesn't have to provide the lender income documentation.</p>
        </Description>
    </product>
    
    <product cat-ref="NCL" id="NCL03">
        <title lang="en">Low Document Loans</title>
        <Description>
            <p>At some point in the past, a borrower may have experienced difficulty in meeting their monthly commitments due to lack of work, suffered unexpected business losses or had a difference of opinion with a former credit provider. Unfortunately, in these cases the former credit provider may have lodged a payment default (or black mark) on their credit report with a credit recording agency. When applying for finance, a default lodged on a credit report may cause some frustration as a lender may not take an understanding view of the borrower’s explanation surrounding the default.</p>
        </Description>
    </product>
    
     <product cat-ref="NCL" id="NCL04">
        <title lang="en">Second Mortgages</title>
        <Description>
        
        	<p>Second Mortgages</p>
            <p>A second mortgage is an additional loan on a property. Second mortgages usually carry a higher interest charge as the first mortgage carries first priority in the case of default. The second mortgage also carries rights to the property, but these are subordinate to those of the first mortgage. In the case of approving a client for a second mortgage, the lender will calculate the affordability and risk of the first mortgage before calculating whether you would be able to meet any additional repayments.</p>
        </Description>
    </product>
 

    <product cat-ref="CEL" id="CEL01">
        <title lang="en">Hire Purchase</title>
        <Description>
        <p>Hire Purchase</p>
            <p>The Hire Purchase Agreement is simply a contract where the lender allows the client the right to possess and use an item of equipment in return for regular payments. When the final payment is made, the title of the goods is transferred to the customer. This product is designed for businesses wishing to finance the purchase of motor vehicles and trucks, industrial plant and equipment, business and professional equipment.
Features and benefits include:</p>
 
  <list type="numbered">
                <list-intro>Features and benefits include:</list-intro>
 
                <list-item>Repayment schedules can be structured to suit a customer’s cash flow.</list-item>
                <list-item>Can be arranged with no deposit or an amount that suits the customer.</list-item>
                <list-item>Flexible repayments allow for accurate capital budgeting..</list-item>
                <list-item>Balloon payments at the end of the term can be arranged</list-item>
                 <list-item>Client gains automatic ownership at end of term..</list-item>
                <list-item>Interest and depreciation are tax deductible if business expense.</list-item>
                <list-item>Client can repay the contract before the term ends.</list-item>
 
            
            </list>      
        </Description>
    </product>
    
     <product cat-ref="CEL" id="CEL02">
        <title lang="en">Finance Lease</title>
        <Description>
            <p>Finance Lease</p>
            
            <p>Here the lender purchases the plant, equipment or vehicle required by the client (the lessee). The lender then leases the goods to the customer under a lease agreement.
When the lease expires the lessee can either:.</p>
        <list type="numbered">
                <list-intro>There are additional benefits associated with a standard variable
                    loan:</list-intro>
 
                <list-item>Return the equipment to the lender who can sell it elsewhere. If the net sale is less than the residual value, the customer must make up the shortfall.</list-item>
                <list-item>Refinance the residual value.</list-item>
                <list-item>Pay out the contract.</list-item>
                <list-item>Make an offer to purchase, which may be accepted by the lender..</list-item>
            
            </list>          
 

 

 </Description>
    </product>
    
         <product cat-ref="BF" id="BF01">
        <title lang="en">Commercial Mortgages</title>
        <Description>
            <b>Commercial Mortgages</b>
            
            <p>A commercial mortgage is similar to a regular residential loan except that the loan is applied to a purchase of commercial property. Commercial property generally includes retail shops or offices, warehouses and factory units.</p>
            <p>Commercial mortgages are handled the same way as regular residential mortgages in that lenders want to ensure that their money will be making them more money. They will want to certify that the property being targeted is worth their investment and that the borrower’s credentials are trustworthy.</p>
            <p>If you are looking to acquire a commercial mortgage the first thing to do is put together a package detailing the potential of the property your want to buy. If possible you should do a little market research that demonstrates the property’s main selling points such as: if it is in a high traffic area, if it is easily accessible, etc… any feature that will make it more attractive in the eyes of a lender, whose main goal is to know that he or she will not lose money on this deal.</p>
            <p>Finding the right lender is the next step and that is where we come in. We do more than just find the right lender for their clients; we also offer support, information and advice. Commercial property can be a great investment if well located and properly managed.</p>
                    
 

 

 </Description>
    </product>
    
            <product cat-ref="BF" id="BF02">
        <title lang="en">Short Term Business Loans</title>
        <Description>
            <b><u>Short Term Business Loans</u></b>
            
            <p>From time to time business or investors find themselves in a situation where they need funds to get them through a short term slump, or to take advantage of a lucrative investment opportunity that presents itself. The business or investor may not be able to access normal loan funds in time to ward off financial difficulties or to take advantage of the opportunity that has presented itself. In both cases short term business loans may be the answer. Short term business loans are for business purposes only and usually the term is measured in months rather than years. The rate is much higher than normal business loans, (3%-10% per month are standard) but are usually easy and quick to obtain. These are pure asset lends with a maximum LVR of 80%. As it is a straight asset lend, credit checks and financials are not usually required.</p>
            
 

 

 </Description>
    </product>
    
      <product cat-ref="BF" id="BF03">
        <title lang="en">Medium-Long Term Business Loans</title>
        <Description>
            <b><u>Medium-Long Term Business Loans</u></b>
            
        <p>Many bank lenders charge hefty interest rate penalties for their business purpose loans. A surcharge of 1-2 percent is not uncommon and some overdraft rates are in excess of 12%. Non bank lenders are able to provide business purpose loans at the same rate as owner occupied home loan rates. If you need money for business purposes, why get ripped off by the banks when you can access the equity in your home or investment property at rates well below 7%.</p>
            
 

 

 </Description>
    </product>
    
     <product cat-ref="IP" id="IP01">
        <title lang="en">Why is an Investment Property a Good Strategy ?</title>
        <Description>
            <b><u>Why is an Investment Property a Good Strategy ?</u></b>
            
       <p>Most people like property because they can see it, touch it and watch it grow in value over a period of time. If bought in the right area (location), it can offer good returns in capital growth in future years. Also, the depreciation, coupled with rental income, makes this method an easy way to get into property and make it an attractive proposition.</p>
       <p>If you already own a property it makes getting into an investment property much easier as you can use the equity in your home as a deposit towards an investment property.</p>     
 

 

 </Description>
    </product>
    
         <product cat-ref="IP" id="IP02">
        <title lang="en">Negative Gearing</title>
        <Description>
            <b><u>Negative Gearing</u></b>
            
       <p>Negative Gearing is the situation when an investment such as property is purchased with the assistance of borrowed funds and where the rental income after the deduction of expenses (such as interest, bank fees, insurance and strata fees) is less than the interest commitment in the course of a financial year.</p>
     <p>For tax purposes this negative net income can then be offset against any positive income from other sources. This is a very handy tool in minimizing tax.</p>
 

 

 </Description>
    </product>
    
           <product cat-ref="IP" id="IP03">
        <title lang="en">Capital Gains Tax</title>
        <Description>
            <b><u>Capital Gains Tax</u></b>
            
      <p>Capital gains are the profits made on selling assets. Your primary place of residence is exempt from any capital gains tax. An investment property sold at a profit will attract a capital gains tax on the profit. The amount will be added to your regular income and taxed at your marginal rate. However, depending on your situation at the time of selling a property, the capital gains tax could be adjusted to be reduced by way of new investments put in place. You should get advice on this matter before selling so that you can structure it correctly.</p>
 

 

 </Description>
    </product>
    
       <product cat-ref="OP" id="OP01">
        <title lang="en">Line of Credit</title>
        <Description>
            <b><u>Line of Credit</u></b>
            
     <p>A Line of Credit provides a borrower with access to the equity in their home or investment properties whenever they wish for any worthwhile purpose. It is similar to an overdraft facility in that funds can be withdrawn up to the original loan approved amount at anytime. The interest rate on a Line of Credit facility is usually a variable rate that fluctuates with the market. A borrower can generally access their Line of Credit via a Cheque Book, Credit Card, ATM, Phone and Internet. A Line of Credit provides a borrower with easy access to funds ensuring peace of mind in times of need.</p>
 

 

 </Description>
    </product>
    
          <product cat-ref="OP" id="OP02">
        <title lang="en">Reverse Mortgages</title>
        <Description>
            <b><u>Reverse Mortgages</u></b>
            
     <p>Unlike conventional mortgage products reverse mortgages (also known as equity release), focus exclusively on a specific segment of the population: retirees. They allow retiring homeowners to access a largely untapped asset to fund a standard of living that for many would otherwise be out of reach. 
Reverse mortgages are similar to conventional residential mortgages in that the borrower raises funds against the security of the home. However, reverse mortgages are very different to conventional mortgages when it comes to drawdown, cash flow, and repayments.</p>
<p>In a normal mortgage, the principal amount of the loan is generally advanced as a lump sum to the borrower in order to a purchase a property. The borrower must then make regular principal and interest payments during the term of the loan. If the borrower defaults on the loan, the lender may recover the outstanding balance of the loan (including any unpaid interest) by enforcing its mortgage and selling the mortgaged home.
That is not the case with a reverse mortgage. In addition to having the option of receiving the principal in an upfront lump sum payment, the retiree can also choose to receive the principal in the form of regular part-payments from the lender during the term of the loan.
The retiree is not required to make any repayments (whether of principal or interest) to the lender during the term of the loan, however in some cases may have the option to do so. Instead, the entire loan (including accrued interest) falls due on the death of the retiree, or when the retiree moves out of the mortgaged home permanently, for example into a nursing home or if the property is sold.</p>
<p>The lender then recovers the loan by either having the beneficiaries of the retiree's estate pay the debt, or by enforcing its mortgage and selling the mortgaged home. In most cases, the lender will give the retiree's beneficiaries up to six months to finalise the debt. If the lender sells the property, they will give any funds left over to the estate of the retiree</p>
 

 </Description>
    </product>
    
    
 

 

 

 

    
    
    <categories>
        <category cat-id="HL">Home Loans</category>
        <category cat-id="NCL">Non-conforming Loans</category>
        <category cat-id="CEL">Car/Equipment Loans</category>
        <category cat-id="BF">Business Finance</category>
		<category cat-id="IP">Investment Property</category>
		<category cat-id="OP">Other Loans</category>
    </categories>
</products>
 
this is the code for the products.xsl
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:key name="product-by-cat" match="product" use="@cat-ref"/>
    <xsl:key name="product-by-id" match="product" use="@id"/>
    
    <xsl:strip-space elements="*"/>
    <xsl:output indent="yes"/>
    
    <xsl:param name="product"/>
    <xsl:param name="base-page" select="'product.php'"/>
    
    <xsl:template match="products">
        <div id="productsdesc">
            <xsl:if test="normalize-space($product)">
                <xsl:apply-templates select="key('product-by-id', $product)/Description"/>
            </xsl:if>
        </div>
        <div id="products">
                     <table>
                        <xsl:for-each select="categories/category[position() mod 3 = 1]">
                            <tr>
                                <th><xsl:apply-templates select="."/></th>
                                <th><xsl:apply-templates select="following-sibling::category[1]"/></th>
                                <th><xsl:apply-templates select="following-sibling::category[2]"/></th>
                            </tr>
                            <xsl:call-template name="get-next-row">
                                <xsl:with-param name="cat1" select="@cat-id"/>
                                <xsl:with-param name="cat2" select="following-sibling::category[1]/@cat-id"/>
                                <xsl:with-param name="cat3" select="following-sibling::category[2]/@cat-id"/>
                                <xsl:with-param name="count" select="1"/>
                            </xsl:call-template>
                        </xsl:for-each>
                    </table>
        </div>
    </xsl:template>
    
    <xsl:template name="get-next-row">
        <xsl:param name="cat1"/>
        <xsl:param name="cat2"/>
        <xsl:param name="cat3"/>
        <xsl:param name="count"/>
        <xsl:if test="key('product-by-cat', $cat1)[position() = $count ]| key('product-by-cat', $cat2)[position() = $count] | key('product-by-cat', $cat3)[position() = $count]">
            <tr>
                <td><a href="{concat($base-page, '?product=', key('product-by-cat', $cat1)[position() = $count ]/@id)}"><xsl:apply-templates select="key('product-by-cat', $cat1)[position() = $count ]/title"/></a></td>
                <td><a href="{concat($base-page, '?product=', key('product-by-cat', $cat2)[position() = $count ]/@id)}"><xsl:apply-templates select="key('product-by-cat', $cat2)[position() = $count ]/title"/></a></td>
                <td><a href="{concat($base-page, '?product=', key('product-by-cat', $cat3)[position() = $count ]/@id)}"><xsl:apply-templates select="key('product-by-cat', $cat3)[position() = $count ]/title"/></a></td>
            </tr>
            <xsl:call-template name="get-next-row">
                <xsl:with-param name="cat1" select="$cat1"/>
                <xsl:with-param name="cat2" select="$cat2"/>
                <xsl:with-param name="cat3" select="$cat3"/>
                <xsl:with-param name="count" select="$count + 1"/>
            </xsl:call-template>
        </xsl:if>
    </xsl:template>
    
    <xsl:template match="p">
        <p>
            <xsl:apply-templates select="node()"/>
        </p>
        <br/>
    </xsl:template>
    
    <xsl:template match="list">
        <p class="list_intro">
            <xsl:apply-templates select="list-intro"/>
        </p>
        <br/>
        <ol>
            <xsl:for-each select="list-item">
                <li><xsl:apply-templates/></li>
            </xsl:for-each>
        </ol>
    </xsl:template>
    
    
</xsl:stylesheet>
 
this is the code for the products.xlst
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:key name="product-by-cat" match="product" use="@cat-ref"/>
    <xsl:key name="product-by-id" match="product" use="@id"/>
    
    <xsl:strip-space elements="*"/>
    <xsl:output indent="yes"/>
    
    <xsl:param name="product"/>
    <xsl:param name="base-page" select="'../product.php'"/>
    
    <xsl:template match="products">
        <div id="productsdesc">
            <xsl:if test="normalize-space($product)">
                <xsl:apply-templates select="key('product-by-id', $product)/Description"/>
            </xsl:if>
        </div>
        <div id="products">
                     <table>
                        <xsl:for-each select="categories/category[position() mod 3 = 1]">
                            <tr>
                                <th><xsl:apply-templates select="."/></th>
                                <th><xsl:apply-templates select="following-sibling::category[1]"/></th>
                                <th><xsl:apply-templates select="following-sibling::category[2]"/></th>
                            </tr>
                            <xsl:call-template name="get-next-row">
                                <xsl:with-param name="cat1" select="@cat-id"/>
                                <xsl:with-param name="cat2" select="following-sibling::category[1]/@cat-id"/>
                                <xsl:with-param name="cat3" select="following-sibling::category[2]/@cat-id"/>
                                <xsl:with-param name="count" select="1"/>
                            </xsl:call-template>
                        </xsl:for-each>
                    </table>
        </div>
    </xsl:template>
    
    <xsl:template name="get-next-row">
        <xsl:param name="cat1"/>
        <xsl:param name="cat2"/>
        <xsl:param name="cat3"/>
        <xsl:param name="count"/>
        <xsl:if test="key('product-by-cat', $cat1)[position() = $count ]| key('product-by-cat', $cat2)[position() = $count] | key('product-by-cat', $cat3)[position() = $count]">
            <tr>
                <td><a href="{concat($base-page, '?product=', key('product-by-cat', $cat1)[position() = $count ]/@id)}"><xsl:apply-templates select="key('product-by-cat', $cat1)[position() = $count ]/title"/></a></td>
                <td><a href="{concat($base-page, '?product=', key('product-by-cat', $cat2)[position() = $count ]/@id)}"><xsl:apply-templates select="key('product-by-cat', $cat2)[position() = $count ]/title"/></a></td>
                <td><a href="{concat($base-page, '?product=', key('product-by-cat', $cat3)[position() = $count ]/@id)}"><xsl:apply-templates select="key('product-by-cat', $cat3)[position() = $count ]/title"/></a></td>
            </tr>
            <xsl:call-template name="get-next-row">
                <xsl:with-param name="cat1" select="$cat1"/>
                <xsl:with-param name="cat2" select="$cat2"/>
                <xsl:with-param name="cat3" select="$cat3"/>
                <xsl:with-param name="count" select="$count + 1"/>
            </xsl:call-template>
        </xsl:if>
    </xsl:template>
    
    <xsl:template match="p">
        <p>
            <xsl:apply-templates select="node()"/>
        </p>
        <br/>
    </xsl:template>
    
    <xsl:template match="list">
        <p class="list_intro">
            <xsl:apply-templates select="list-intro"/>
        </p>
        <br/>
        <ol>
            <xsl:for-each select="list-item">
                <li><xsl:apply-templates/></li>
            </xsl:for-each>
        </ol>
    </xsl:template>
    
    
</xsl:stylesheet>
 
thank you all for your help in advance
Questiongenerating html tree from xml file using xslt.memberanikbutt2210 Feb '12 - 1:41 
hi guys.i want to generate html tree from xml file using xslt.. how can i do tht.. i have tried plenty of examples from net.. but didnt get the correct.. code... plz reply.. regards,
QuestionHow to open zipfile and xlsmemberThemba Zwane8 Feb '12 - 7:53 
How to open Zip file and Xls files
AnswerRe: How to open zipfile and xlsmvpRichard MacCutchan8 Feb '12 - 21:54 
In what language, for what purpose?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
 


AnswerRe: How to open zipfile and xlsmemberryanb3119 Mar '12 - 9:02 
Double-click on it.
There are only 10 types of people in the world, those who understand binary and those who don't.

QuestionImplementing Apriori Algorithm with XQuerymemberhelloworld202018 Jan '12 - 1:47 
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 Smile | :)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 19 Apr 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid