Re: [CEDET-devel] xslt templates support in ECB
Brought to you by:
zappo
From: Mansour Al A. <man...@gm...> - 2011-06-26 11:46:21
|
Hello Eric, Thank you for helping in this. There's a mode that I didn't install and not familiar with for XSLT http://www.emacswiki.org/emacs/xsl-mode.el I am not at that point, as I am stuck trying to understand the function: ============================================== semantic-tag-get-attribute is a compiled Lisp function in `semantic-tag.el'. (semantic-tag-get-attribute TAG ATTRIBUTE) >From TAG, return the value of ATTRIBUTE. ATTRIBUTE is a symbol whose specification value to get. Return the value found, or nil if ATTRIBUTE is not one of the attributes of TAG. ============================================== Things I need, is the structure for TAG, and how it's composed. I can see a function called: semantic-html-new-section-tag and it's called from: semantic-html-recursive-combobulate-list But still don't fully understand them. Do I need to modify the *-html-* part in all these functions and replace it with "*-xsl-*". Like semantic-html-new-section-tag change to semantic-xsl-new-section-tag ?? On Sat, Jun 25, 2011 at 4:30 PM, Eric M. Ludlam <eri...@gm...> wrote: > Hi, > > I started experimenting with this today. Do you have an xslt mode? If you > just replace "html" with "xslt", it will try to attach things to xslt-mode, > which I didn't find a copy of. > > If you are using xml-mode, or nxml-mode, then putting this parser you are > deriving against it would likely cause all other xml files to get messed up. > > It may be necessary to derive an xslt-mode from nxml-mode just to have > something to hang your parser from. > > Anyway, that looks like the most likely reason you were able to create > something you think should work that has no effect, as the simple > search/replace coding style will try to attach to a non-existent mode. > > Eric > > On 06/25/2011 09:06 AM, Mansour Al Akeel wrote: >> >> Eric, >> Thank you for the info. In fact I had a look at the XML parser link, >> and I think it will help me in the future. I am not sure about imenu >> support (and not familiar with imenu), however I wasn't able to find >> anything related to XSLT and ECB. >> >> With regard to xslt it's very simple, especially what I am looking >> for. Templates (functions) are located directly under the root >> (children). Variables are not widely used globally except for >> customization. May be this in only my own way to use variables. Here's >> an example >> >> <xsl:stylesheet version="1.0" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> >> <xsl:variable name="customization-variable select="9" /> >> <xsl:template match="/"> >> This is a message "Hello World" ! >> It will print the message when it matched any root element ! >> </xsl:template> >> <xsl:template name="a-template-that-needs-to-be-called"> >> This is another message >> </xsl:template> >> </xsl:stylesheet> >> >> I am not expecting parsing this to be very hard job, but the issue I >> am facing is connecting the dots and understanding how things work >> together and get going. For example, I followed everyones suggestion >> about starting with the existing semantics (keep in mind I not an >> elisp pro), so I copied >> "/usr/share/emacs/site-lisp/cedet/semantic/semantic-html.el" to >> ~/.emacs.d/ and started editing it. Now what I understand, all I have >> to do is to modify the function : >> >> (defun semantic-html-components (tag) >> "Return components belonging to TAG." >> (semantic-tag-get-attribute tag :members)) >> >> To return a list of the xslt templates "names" to be displayed in the >> ECB methods window. Initially, all I trying to do, is to show any >> string in the methods window, just to be able to test my code after >> each addition. I am still unable to do this, and to get started >> because of this ! >> So for example, how can I just edit this to display a "String" ? >> >> (defun semantic-xslt-templates (tag) >> "My Message" >> ) >> >> These kind of small little issues are the challenging part to me. :) >> >> Any way, I truly appreciate your help. >> >> >> >> On Wed, Jun 22, 2011 at 6:45 PM, Eric M. Ludlam<eri...@gm...> >> wrote: >>> >>> On 06/19/2011 11:54 PM, Mansour Al Akeel wrote: >>>> >>>> I did a post to the ECB mailing asking about a way to add XSLT >>>> templates support, in the ECB methods window. If it's easier to add a >>>> language support for XSLT, then I will try to go down this route. >>>> The question can be found here >>>> http://sourceforge.net/mailarchive/message.php?msg_id=27674671 >>>> >>>> I decided to take a look at the existing parsers "semantic-html.el" >>>> and "semanticdb-javascript.el" to get an idea about the work needed to >>>> get started. Knowing that I am not very in elisp, it will take me >>>> sometime. >>>> >>>> This is not a problem, but my question is, is this the easiest and >>>> fastest way to add a language support ? >>> >>> Hi, >>> >>> I have often thought it would be useful to enable the existing xml >>> parser >>> in Emacs and just adapt the output for Semantic. That would probably be >>> the >>> most robust way to accomplish this task. Unfortunately, there are no >>> examples of how to adapt one parser to another, but if you know the xslt >>> keywords and where they show up in the xml parser output, then converting >>> that to a list of Semantic tags (nested together or not) is easy. I >>> found >>> short examples online here: >>> http://www.emacswiki.org/emacs/XmlParserExamples >>> >>> If the xml parser output from Emacs excludes positional information >>> (where >>> in the buffer the text came from) then you will probably need to write >>> something with a lexer and parser. In that case, the documentation about >>> wisent is best. >>> >>> If you go with a short-cut, like the html parser, then just use the html >>> parser as a place to start. I don't know how complex xslt is when it >>> comes >>> to tag info, but if it is mildly hierarchical like html, you will >>> probably >>> be safe and get something pretty good running quickly. >>> >>> You also mention just using ECB. ECB also uses imenu support, so it may >>> be >>> that xslt already has imenu support from some other library and you just >>> need to download it. >>> >>> Eric >>> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense.. >> http://p.sf.net/sfu/splunk-d2d-c1 >> _______________________________________________ >> Cedet-devel mailing list >> Ced...@li... >> https://lists.sourceforge.net/lists/listinfo/cedet-devel > |