Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
F

Fadi Yoosuf

@Fadi Yoosuf
About
Posts
28
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Representing physical directory strucure
    F Fadi Yoosuf

    Hi I am planning to implement a custom version control system. Is there anyway to represent physical directory structure in database? Or should I represent them using 'tree' data structure? If using tree data structure, how can I save the contents of tree to an external file?? thanks fadi

    Algorithms question database data-structures collaboration announcement

  • Database Schema to represent directory structure
    F Fadi Yoosuf

    Hi I am planning to implement a custom version control system. Is there anyway to represent physical directory structure in database? Or should I represent them using 'tree' data structure? If using tree data structure, how can I save the contents of tree to an external file?? thanks fadi

    Database database question data-structures collaboration xml

  • Generating multiple files using XSLT 1.0
    F Fadi Yoosuf

    I got one more query. Will it be possible by embedding script in xslt? I tried the following way Xslt file

    ?xml version="1.0" encoding="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"
    xmlns:user="urn:myscripts"

    <xsl:output method="xml" indent="yes"/>
    

    <msxsl:script language="C#" implements-prefix="user">
    <![CDATA[
    public void SaveOutput(string fileName)
    {

      System.IO.TextWriter t = new System.IO.StreamWriter(fileName);
      t.Write("got it");
      t.Flush();
    }
    \]\]>
    

    </msxsl:script>

    <xsl:template match="@* | node()">
    <xsl:value-of select="user:SaveOutput('d:\testing.txt')"/>

    </xsl:template>
    

    </xsl:stylesheet>

    My C# code is

        private void ScriptTest()
        {
            XsltSettings settings = new XsltSettings();
            settings.EnableScript = true;
    
            XslCompiledTransform trs = new XslCompiledTransform();
            trs.Load("Custom.xslt", settings, new XmlUrlResolver());
            StreamWriter writer = new StreamWriter(@"e:\\samples.txt");
            trs.Transform(@"E:\\\\9.xml", null, writer);
    
            writer.Flush();
            writer.Close();
        }
    

    But when I run the code, I get en error like IOException unhandled - The device is not ready Thank you Fadi

    XML / XSL csharp ai-coding xml question

  • Generating multiple files using XSLT 1.0
    F Fadi Yoosuf

    Thank you Stuart But can you clarify some more things? My xml file is

    <?xml version="1.0" encoding="utf-8" ?>
    <bookstore>
    <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
    <first-name>Benjamin</first-name>
    <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
    </book>
    <book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
    <title>The Confidence Man</title>
    <author>
    <first-name>Herman</first-name>
    <last-name>Melville</last-name>
    </author>
    <price>11.99</price>
    </book>
    <book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
    <title>The Gorgias</title>
    <author>
    <name>Plato</name>
    </author>
    <price>9.99</price>
    </book>
    </bookstore>

    My xslt file is

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:output="urn:output">

    <xsl:template match="bookstore">
    <bookstore>
    <xsl:for-each select="book">
    <book>
    <xsl:copy-of select="node()"/>
    <new-price>
    <xsl:value-of select="output:SaveOutput(@genre, node())"/>
    </new-price>
    </book>
    </xsl:for-each>
    </bookstore>
    </xsl:template>
    </xsl:stylesheet>

    C# code goes like

    private void ExtensionTest()
    {
    XslCompiledTransform xslt = new XslCompiledTransform();
    xslt.Load("extension.xslt");
    XsltArgumentList xslArg = new XsltArgumentList();

            OutputSaver obj = new OutputSaver();
            xslArg.AddExtensionObject("urn:output", obj);
            using (XmlWriter w = XmlWriter.Create("output.xml"))
            {
                xslt.Transform("books.xml", xslArg, w);
            }
    

    }
    public class OutputSaver
    {
    public void SaveOutput(string fileName, string node)
    {
    StreamWriter s = new StreamWriter(fileName);
    s.Write(node);
    s.Flush();
    }
    }

    Now I have 2 issues * How to pass the xslt node content to SaveOutput

    XML / XSL csharp ai-coding xml question

  • Generating multiple files using XSLT 1.0
    F Fadi Yoosuf

    Hi I am doing a code generation app. using .Net 3.5. I wish to know if it is possible to generate multiple code files from a single xslt file. I know that it can be accomplished in XSLT 2.0 using result-document tag. Is it possible using XSLT 1.0 ? Thanks Fadi

    XML / XSL csharp ai-coding xml question

  • How to pass multiple parameters while invoking a process
    F Fadi Yoosuf

    I had tried putting spaces. but it didn't work out. W.r.t. ur reply, i tried putting quotes for the strings with spaces and it worked fine..... Thank you very much Luc

    .NET (Core and Framework) question tutorial

  • How to pass multiple parameters while invoking a process
    F Fadi Yoosuf

    Hi Hi I am using System.Diagonostics.Process.Start for staring a new process. If I want to pass mulitple marameters with different switches, how can I do it? Thanks Fadi

    .NET (Core and Framework) question tutorial

  • Problem with String.Split()
    F Fadi Yoosuf

    you can use Substring method instead of Split method. find the index of '=' character using IndexOf method and then pass this index + 1 as the parameter of Substring method.

    C# csharp data-structures help question

  • SequenceEqual and LINQ
    F Fadi Yoosuf

    Thank you very much

    LINQ question csharp linq help

  • Specifying condition with count function
    F Fadi Yoosuf

    Thank you very much Stuart.. It really worked... Hats off to u

    XML / XSL xml tutorial ai-coding question

  • SequenceEqual and LINQ
    F Fadi Yoosuf

    Hi I have a class named Item. It has the public members, 'Name' and 'Subitems'. I have declared a list of Items (List itemList). Now I want to write a function which accepts a new 'Item' and decides if itemList already has the 'Item'. I tried writing a function like bool Check(Item p) { return itemList.Exists(m=> m.Name == p.Name && m.SubItems.SequenceEqual(p.SubItems)); } Here the issue is, default comparing is done for SequenceEqual method. I want to compare SubItems using the Name property of the SubItems. How can I modify my function so that SequenceEqual works based on the NameProperty of the subitem? Thank you Fadi

    LINQ question csharp linq help

  • Specifying condition with count function
    F Fadi Yoosuf

    Hi I am writing a code generation app using xslt. My purpose is to check if any two nodes of the same parent node, have the same attribute value. If so I want to append a number sequence in the ouput code, so that there is no duplication. For example ------------- if xml file is like <code> <methods> <method name="first"> <method name="first"> <method name="second"> <method name="third"> </methods></code> I want the output to be ------------- void first1() {} void first2() {} void second() {} void third() {} Note: there is no number sequence attached to function name if it is not duplicated. How to write XSLT to achieve this? Thank you Fadi

    XML / XSL xml tutorial ai-coding question

  • connection parameters in configuration file
    F Fadi Yoosuf

    Thank you very much for the info. But I wish to know one more thing. How huge applications like encyclopedias stores information? If they store in database, how is it possible to install them, without having the database server in the system?

    Database help question database xml architecture

  • connection parameters in configuration file
    F Fadi Yoosuf

    hi, I have a program which does some operations with database.(Single tier architecture) I will sometimes have to move the application to other systems having the database. In order to make the database connection parameters configurable, i am storing the params such as username, password etc. in an xml file. Is it the correct way to handle the situation? If so will it be safe to store the database password in an xml file? how can i solve the issue? If the application is meant for ordinary users(who may not have the database files), how can we approach the problem? Cconfiguration file will not be easy for him to edit no? Thank you Fadi

    Database help question database xml architecture

  • Output not obtained
    F Fadi Yoosuf

    thank you very much George.... it is really helpful @ this situation... led, lemme thank u also for ur efforts.(but you should understand the seriousness of misguiding someone(and all who read the post) with respect to a temporary output. there were errors in my xslt. you didn't even point out that. What if I had blindly believed you!!!!!)

    XML / XSL xml testing beta-testing regex help

  • Output not obtained
    F Fadi Yoosuf

    Led, You argued like "A Web Browser is only going to display HTML." Was it a blind response? When you get time, make an html file, open it in edit mode and paste plain text in that. Try viewing in a browser and you can still see the plain text (which was written without html markups). Now try creating another .html file and paste some xml conent in that. Try viewing in a browser and you can still see the innertext of html nodes in a non formatted manner. Can you pls. explain the reason for this w.r.t. your argument?? Also can you try the default xml given in http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog[^]. Just change the xslt content as follows ---------------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited by XMLSpy® --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:for-each select="catalog/cd"> <xsl:value-of select="title"/> <xsl:value-of select="artist"/> </xsl:for-each> </xsl:template> </xsl:stylesheet> ---------------------------- Now can you pls explain why the output is displayed in the browser even if it is in text format?? If you find a solution, can you pls. explain what is wrong with my code in the first post?? Sorry for disturbing you again It would be nice of you, if you can convince me with a good answer Thanks Fadi

    XML / XSL xml testing beta-testing regex help

  • Output not obtained
    F Fadi Yoosuf

    Thanks alot for the effective criticism. I overestimated (mistook) like the system had the facility to convert xml/text formats to html. Anyway "alerted hereafter" :) thanks Fadi

    XML / XSL xml testing beta-testing regex help

  • Output not obtained
    F Fadi Yoosuf

    You can paste the xml and xslt I gave in w3schools' xslt tester. I have pasted the link below http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog[^] thanks fadi

    XML / XSL xml testing beta-testing regex help

  • Output not obtained
    F Fadi Yoosuf

    Hi... when I apply xsl transformation, no output is obtained. Can anyone help me? My xml file is --------------------- <?xml version="1.0" encoding="utf-8"?> <Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <MySpace>Testing</MySpace> </Data> --------------------- My xslt file is ----------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" indent="yes"/> <xsl:template match="/"> <value-of select="MySpace"/> </xsl:template> </xsl:stylesheet> ----------------------- Thanks Fadi

    XML / XSL xml testing beta-testing regex help

  • Retaining selected node of treeview
    F Fadi Yoosuf

    hi I am having a treeview in the left, a list view in the right and a refresh button. Treeview shows year,month and dates while listview shows the logs for the current date selected date. While pressing refresh button, I have to update both treeview and listview from the latest data in dataset. How can I retain the selected node of the treeview when it is updated. thanks Fadi

    Windows Forms question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups