www.digitalmars.com         C & C++   DMDScript  

D - DML?

reply "Pavel Minayev" <evilone omen.ru> writes:
Some more ideas/questions concerning DML (D XML =)):

What's with blocks? We had a discussion here conserning them
earlier, but the problem is even wider. How does the
XML-to-D converter differentiate between else-if and other
cases? I'd expect it to give different outputs:

    if (a == 1)
        foo();
    else if (b == 2)
        bar();

--- but ---

    if (a == 1)
        foo();
    else
        while (b == 2)
            bar();

I believe most programmers put if on the same line with else
in such cases... so the converter must be able to detect
this case and process it properly. Is XSLT capable of doing
such things?
Jan 18 2002
parent reply "OddesE" <OddesE_XYZ hotmail.com> writes:
"Pavel Minayev" <evilone omen.ru> wrote in message
news:a2aglg$3fk$1 digitaldaemon.com...
 Some more ideas/questions concerning DML (D XML =)):

 What's with blocks? We had a discussion here conserning them
 earlier, but the problem is even wider. How does the
 XML-to-D converter differentiate between else-if and other
 cases? I'd expect it to give different outputs:

     if (a == 1)
         foo();
     else if (b == 2)
         bar();

 --- but ---

     if (a == 1)
         foo();
     else
         while (b == 2)
             bar();

 I believe most programmers put if on the same line with else
 in such cases... so the converter must be able to detect
 this case and process it properly. Is XSLT capable of doing
 such things?
Do you mean that you would expect the resulting .d code to look like this? if (a == 1) foo(); else while (b == 2) bar(); If this is what you mean, then yes, the XSLT stylesheet could definitely do such things. It all depends on the way you structure the XML data how far you can go in tweaking the layout of the code though, so thinking up a good standard is important. And actually, I don't put the while on the same line than the else in such a case. I would lay it out like this: if (a == 1) foo(); else { while (b == 2) bar(); } Or at most leave out the curly braces. But the same XML code should be able to produce both of these results in combination with the right XSLT stylesheet. :) -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net __________________________________________ Remove _XYZ from my address when replying by mail
Jan 19 2002
parent reply "Pavel Minayev" <evilone omen.ru> writes:
"OddesE" <OddesE_XYZ hotmail.com> wrote in message
news:a2cs4l$1o01$1 digitaldaemon.com...

 Do you mean that you would expect the resulting .d code
 to look like this?
I expect it to look like I've written it there - else-if should be on one line, and else-while (or whatever else) - on two different.
Jan 19 2002
next sibling parent "OddesE" <OddesE_XYZ hotmail.com> writes:
"Pavel Minayev" <evilone omen.ru> wrote in message
news:a2dnlf$29h0$1 digitaldaemon.com...
 "OddesE" <OddesE_XYZ hotmail.com> wrote in message
 news:a2cs4l$1o01$1 digitaldaemon.com...

 Do you mean that you would expect the resulting .d code
 to look like this?
I expect it to look like I've written it there - else-if should be on one line, and else-while (or whatever else) - on two different.
It should definitely be possible to tweak this kind of settings if the DML spec was designed right. -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net __________________________________________ Remove _XYZ from my address when replying by mail
Jan 20 2002
prev sibling parent reply "J. Daniel Smith" <j_daniel_smith deja.com> writes:
It would be entirely up to the XSLT stylesheet to determine how to render in
HTML (turning DML into D really only needs to be done by the compiler).
XSLT is pretty powerful, so I'm sure it can be done.

I've done a tiny little bit of playing with some of this just to have
something concrete to work with; it's not pretty or polished, but it does
give you a flavor of what's possible.  Take a look at
http://jdanielsmith.org/DML

   Dan

"Pavel Minayev" <evilone omen.ru> wrote in message
news:a2dnlf$29h0$1 digitaldaemon.com...
 "OddesE" <OddesE_XYZ hotmail.com> wrote in message
 news:a2cs4l$1o01$1 digitaldaemon.com...

 Do you mean that you would expect the resulting .d code
 to look like this?
I expect it to look like I've written it there - else-if should be on one line, and else-while (or whatever else) - on two different.
Jan 21 2002
parent reply "OddesE" <OddesE_XYZ hotmail.com> writes:
"J. Daniel Smith" <j_daniel_smith deja.com> wrote in message
news:a2hud6$202q$1 digitaldaemon.com...
 It would be entirely up to the XSLT stylesheet to determine how to render
in
 HTML (turning DML into D really only needs to be done by the compiler).
 XSLT is pretty powerful, so I'm sure it can be done.

 I've done a tiny little bit of playing with some of this just to have
 something concrete to work with; it's not pretty or polished, but it does
 give you a flavor of what's possible.  Take a look at
 http://jdanielsmith.org/DML

    Dan

 "Pavel Minayev" <evilone omen.ru> wrote in message
 news:a2dnlf$29h0$1 digitaldaemon.com...
 "OddesE" <OddesE_XYZ hotmail.com> wrote in message
 news:a2cs4l$1o01$1 digitaldaemon.com...

 Do you mean that you would expect the resulting .d code
 to look like this?
I expect it to look like I've written it there - else-if should be on one line, and else-while (or whatever else) - on two different.
WOW! This is exactly the kind of stuff I was thinking about. Check this out people, it shows some of the power of DML real well. Dan, do you have a lot of experience wit XML? I know what it *can* do but not really *how* to do it. Way cool this! :) -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net __________________________________________ Remove _XYZ from my address when replying by mail
Jan 21 2002
parent reply "Juan Carlos Arevalo Baeza" <jcab roningames.com> writes:
"OddesE" <OddesE_XYZ hotmail.com> wrote in message
news:a2i4qg$246k$1 digitaldaemon.com...

 "J. Daniel Smith" <j_daniel_smith deja.com> wrote in message
 news:a2hud6$202q$1 digitaldaemon.com...

 I've done a tiny little bit of playing with some of this just to have
 something concrete to work with; it's not pretty or polished, but it
does
 give you a flavor of what's possible.  Take a look at
 http://jdanielsmith.org/DML
WOW! This is exactly the kind of stuff I was thinking about. Check this out people, it shows some of the power of DML real well.
So... how do you use that viewer link? Salutaciones, JCAB
Jan 21 2002
parent reply "OddesE" <OddesE_XYZ hotmail.com> writes:
"Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
news:a2i7mi$2601$1 digitaldaemon.com...
 "OddesE" <OddesE_XYZ hotmail.com> wrote in message
 news:a2i4qg$246k$1 digitaldaemon.com...

 "J. Daniel Smith" <j_daniel_smith deja.com> wrote in message
 news:a2hud6$202q$1 digitaldaemon.com...

 I've done a tiny little bit of playing with some of this just to have
 something concrete to work with; it's not pretty or polished, but it
does
 give you a flavor of what's possible.  Take a look at
 http://jdanielsmith.org/DML
WOW! This is exactly the kind of stuff I was thinking about. Check this out people, it shows some of the power of DML real well.
So... how do you use that viewer link? Salutaciones, JCAB
Juan, Click on elsif.xml and when the page opens, copy the address to the clipboard. Go back and click on viewer.htm, then paste the address into the edit field. Select HTML or D and click View to view the results. Ofcourse, the D code looks messed up in the browser, but the HTML code looks fine. Walter, how should I read the syntax specifications for D on your site: Syntax Grammar? For instance, should I read decl_def: import class_decl_def struct_decl_def union_decl_def enum_decl_def As: "A decl_def consists of any of these elements in any order"? I think a good DML specification should mimic your syntax grammar as close as possible. A DML version of the above could be: <decl_def> <import> </import> <class_decl_def> </class_decl_def> <struct_decl_def> </struct_decl_def> <union_decl_def> </union_decl_def> <enum_decl_def> </enum_decl_def> </decl_def> Could you point me to a good resource where I could learn to read the grammar rules on your page? Thanks. -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net __________________________________________ Remove _XYZ from my address when replying by mail
Jan 22 2002
next sibling parent reply "Juan Carlos Arevalo Baeza" <jcab roningames.com> writes:
"OddesE" <OddesE_XYZ hotmail.com> wrote in message
news:a2k6hl$dql$1 digitaldaemon.com...
 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2i7mi$2601$1 digitaldaemon.com...
 "OddesE" <OddesE_XYZ hotmail.com> wrote in message
 news:a2i4qg$246k$1 digitaldaemon.com...

 "J. Daniel Smith" <j_daniel_smith deja.com> wrote in message
 news:a2hud6$202q$1 digitaldaemon.com...

 I've done a tiny little bit of playing with some of this just to
have
 something concrete to work with; it's not pretty or polished, but it
does
 give you a flavor of what's possible.  Take a look at
 http://jdanielsmith.org/DML
WOW! This is exactly the kind of stuff I was thinking about. Check this out people, it shows some of the power of DML real well.
So... how do you use that viewer link? Salutaciones, JCAB
Juan, Click on elsif.xml and when the page opens, copy the address to the clipboard. Go back and click on viewer.htm, then paste the address into the edit field. Select HTML or D and click View to view the results. Ofcourse, the D code looks messed up in the browser, but the HTML code looks fine.
Ok. So I had tried it right. But I just get "Error on Page" in the status line of IE. :-P Salutaciones, JCAB
Jan 22 2002
parent "J. Daniel Smith" <j_daniel_smith deja.com> writes:
You need the new(er) XML objects which support the 1999 XSLT specification;
the ones that are part of IE 5.0 support the old (and now poorly documented)
XD XSL transform.

Also, you can just type "elseif.xml" into the text field - the full URL
isn't needed.

   Dan

"Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
news:a2ke01$ijm$1 digitaldaemon.com...
 "OddesE" <OddesE_XYZ hotmail.com> wrote in message
 news:a2k6hl$dql$1 digitaldaemon.com...
 "Juan Carlos Arevalo Baeza" <jcab roningames.com> wrote in message
 news:a2i7mi$2601$1 digitaldaemon.com...
 "OddesE" <OddesE_XYZ hotmail.com> wrote in message
 news:a2i4qg$246k$1 digitaldaemon.com...

 "J. Daniel Smith" <j_daniel_smith deja.com> wrote in message
 news:a2hud6$202q$1 digitaldaemon.com...

 I've done a tiny little bit of playing with some of this just to
have
 something concrete to work with; it's not pretty or polished, but
it
 does
 give you a flavor of what's possible.  Take a look at
 http://jdanielsmith.org/DML
WOW! This is exactly the kind of stuff I was thinking about. Check this out people, it shows some of the power of DML real well.
So... how do you use that viewer link? Salutaciones, JCAB
Juan, Click on elsif.xml and when the page opens, copy the address to the clipboard. Go back and click on viewer.htm, then paste the address into the edit field. Select HTML or D and click View to view the results. Ofcourse, the D code looks messed up in the browser, but the HTML code looks fine.
Ok. So I had tried it right. But I just get "Error on Page" in the
status
 line of IE. :-P

 Salutaciones,
                          JCAB
Jan 22 2002
prev sibling next sibling parent "Walter" <walter digitalmars.com> writes:
"OddesE" <OddesE_XYZ hotmail.com> wrote in message
news:a2k6hl$dql$1 digitaldaemon.com...
 how should I read the syntax specifications for D on
 your site: Syntax Grammar?

 For instance, should I read

 decl_def:
     import
     class_decl_def
     struct_decl_def
     union_decl_def
     enum_decl_def

 As: "A decl_def consists of any of these elements in any order"?
No, it reads that a decl_def is an import or a class_decl_def or a ...
 I think a good DML specification should mimic your syntax
 grammar as close as possible. A DML version of the above
 could be:

 <decl_def>
     <import>
     </import>
     <class_decl_def>
     </class_decl_def>
     <struct_decl_def>
     </struct_decl_def>
     <union_decl_def>
     </union_decl_def>
     <enum_decl_def>
     </enum_decl_def>
 </decl_def>

 Could you point me to a good resource where I could learn
 to read the grammar rules on your page?
I sort of made it up <g>, but it is like how most people do it in language specs. I don't have any handy references.
Jan 23 2002
prev sibling parent reply Karl Bochert <kbochert ix.netcom.com> writes:
 
 Juan,
 
 Click on elsif.xml and when the page opens, copy the address
 to the clipboard. Go back and click on viewer.htm, then paste
 the address into the edit field. Select HTML or D and click
 View to view the results. Ofcourse, the D code looks messed
 up in the browser, but the HTML code looks fine.
 
I use the Opera 5.0 browser which, I beleive is very standards-compliant and quite recent. d.xsl and xhtml.xsl produce identical pages -- "if (){}else{}()" elsif.xml produces a blank page. viewer.htm produces a selection box which doesn't seem to do anything. What is this address that goes in the edit field?
Jan 24 2002
next sibling parent reply "J. Daniel Smith" <j_daniel_smith deja.com> writes:
You'll need a browser like IE which supports viewing XML files directly to
see the XSL files (they are really just another type of XML file).  In any
case, I've tweaked things so that you no longer need to use the "viewer.htm"
page: http://jdanielsmith.org/DML

   Dan

"Karl Bochert" <kbochert ix.netcom.com> wrote in message
news:1103_1011892765 bose...
 Juan,

 Click on elsif.xml and when the page opens, copy the address
 to the clipboard. Go back and click on viewer.htm, then paste
 the address into the edit field. Select HTML or D and click
 View to view the results. Ofcourse, the D code looks messed
 up in the browser, but the HTML code looks fine.
I use the Opera 5.0 browser which, I beleive is very standards-compliant and quite recent. d.xsl and xhtml.xsl produce identical pages -- "if (){}else{}()" elsif.xml produces a blank page. viewer.htm produces a selection box which doesn't seem to do anything. What is this address that goes in the edit field?
Jan 24 2002
next sibling parent "J. Daniel Smith" <j_daniel_smith deja.com> writes:
Also, if your browser can't load the MSXML2 objects to do the XSLT
transform, I redirect to a page on the server to do the transform.  This
should make the samples much more viewable (you'll still need JavaScript
though).

   Dan

"J. Daniel Smith" <j_daniel_smith deja.com> wrote in message
news:a2qepg$c5d$1 digitaldaemon.com...
 You'll need a browser like IE which supports viewing XML files directly to
 see the XSL files (they are really just another type of XML file).  In any
 case, I've tweaked things so that you no longer need to use the
"viewer.htm"
 page: http://jdanielsmith.org/DML

    Dan

 "Karl Bochert" <kbochert ix.netcom.com> wrote in message
 news:1103_1011892765 bose...
 Juan,

 Click on elsif.xml and when the page opens, copy the address
 to the clipboard. Go back and click on viewer.htm, then paste
 the address into the edit field. Select HTML or D and click
 View to view the results. Ofcourse, the D code looks messed
 up in the browser, but the HTML code looks fine.
I use the Opera 5.0 browser which, I beleive is very standards-compliant and quite recent. d.xsl and xhtml.xsl produce identical pages -- "if (){}else{}()" elsif.xml produces a blank page. viewer.htm produces a selection box which doesn't seem to do anything. What is this address that goes in the edit field?
Jan 25 2002
prev sibling parent Karl Bochert <kbochert ix.netcom.com> writes:
On Thu, 24 Jan 2002 21:11:01 -0500, "J. Daniel Smith" <j_daniel_smith deja.com>
wrote:
 You'll need a browser like IE which supports viewing XML files directly to
 see the XSL files (they are really just another type of XML file).  In any
 case, I've tweaked things so that you no longer need to use the "viewer.htm"
 page: http://jdanielsmith.org/DML
 
    Dan
Tried that page, and nothing seemed to make any sense. Most links produced: "The value of the 'method' attribute may not be 'html'." or: "The value of the 'method' attribute may not be 'text'." I'll just have to wait unil I switch to IE (a long time).
Jan 27 2002
prev sibling parent reply "OddesE" <OddesE_XYZ hotmail.com> writes:
"Karl Bochert" <kbochert ix.netcom.com> wrote in message
news:1103_1011892765 bose...
 Juan,

 Click on elsif.xml and when the page opens, copy the address
 to the clipboard. Go back and click on viewer.htm, then paste
 the address into the edit field. Select HTML or D and click
 View to view the results. Ofcourse, the D code looks messed
 up in the browser, but the HTML code looks fine.
I use the Opera 5.0 browser which, I beleive is very standards-compliant and quite recent. d.xsl and xhtml.xsl produce identical pages -- "if (){}else{}()" elsif.xml produces a blank page. viewer.htm produces a selection box which doesn't seem to do anything. What is this address that goes in the edit field?
The edit field should contain the address of the xml file to transform, elseif.xml in this case. In the selection box you should choose wheter to transform to D (using d.xsl) or to HTML (using xhtml.xsl). When you press the button you should see the resulting file in your browser. -- Stijn OddesE_XYZ hotmail.com http://OddesE.cjb.net __________________________________________ Remove _XYZ from my address when replying by mail
Jan 24 2002
parent "Sean L. Palmer" <spalmer iname.com> writes:
Hint:  put some instructions on the page itself.  ;)

Sean

"OddesE" <OddesE_XYZ hotmail.com> wrote in message
news:a2s3t1$5r7$1 digitaldaemon.com...
 "Karl Bochert" <kbochert ix.netcom.com> wrote in message
 news:1103_1011892765 bose...
 Juan,

 Click on elsif.xml and when the page opens, copy the address
 to the clipboard. Go back and click on viewer.htm, then paste
 the address into the edit field. Select HTML or D and click
 View to view the results. Ofcourse, the D code looks messed
 up in the browser, but the HTML code looks fine.
I use the Opera 5.0 browser which, I beleive is very standards-compliant and quite recent. d.xsl and xhtml.xsl produce identical pages -- "if (){}else{}()" elsif.xml produces a blank page. viewer.htm produces a selection box which doesn't seem to do anything. What is this address that goes in the edit field?
The edit field should contain the address of the xml file to transform, elseif.xml in this case. In the selection box you should choose wheter to transform to D (using d.xsl) or to HTML (using xhtml.xsl). When you press the button you should see the resulting file in your browser. -- Stijn
Jan 25 2002