ECB is probably using imenu support from the new major mode. If you
look in major mode you are using for some imenu based setting, you can
probably recycle that in your nxml-mode-hook.
Eric
On 06/26/2011 09:54 AM, Mansour Al Akeel wrote:
> Eric,
> There's something that I didn't know. I just tried to open an xsl file
> with ECB and it looks like it's supported. All I did is installed
> psgml package.
> This is good, as I can see the templates now in "ECB Methods" window,
> and navigate to them easily. A little issue is, I used to use
> nxml-mode, and it supports schema on fly validation.
> So if I add an element or an attributte that's wrong, it will high
> light it. The mode that is active now is XSL majour mode, and this is
> the one that gives me the methods in ECB buffer.
> Do you know of anyway to obtain functionality from both ?
>
>
> On Sun, Jun 26, 2011 at 8:40 AM, Eric M. Ludlam<ericludlam@...> wrote:
>> I don't know much about all the xml modes. I do think that if a parser
>> exists for xslt, but it then gets applied to all XML modes (like your data
>> or some-such) that would be surprising and un-useful.
>>
>> If you typically use nxml-mode, then you can use define-derived-mode to
>> create the requisite symbol, then add something to auto-mode-alist to use it
>> automatically instead of nxml mode. I think that's all that is needed. You
>> would then get the benefits of nxml-mode, but have the right symbol for your
>> parser.
>>
>> Eric
>>
>> On 06/26/2011 08:27 AM, Mansour Al Akeel wrote:
>>>
>>> Eric,
>>> there's multiple modes for xsl "xsl-mode", nxml-mode, xslide ... etc.
>>> I am not sure if each one has a parser, but on my gentoo, I can see
>>> xsl parser is include by default with emacs.
>>> If you need to include one of the modes for xsl, wouldn't it be better
>>> to use the one that is widely used ?
>>> xsl-mode is not available through "portage" package management system,
>>> so is't popular ?
>>>
>>>
>>> On Sat, Jun 25, 2011 at 4:30 PM, Eric M. Ludlam<ericludlam@...>
>>> 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<ericludlam@...>
>>>>> 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
>>>>> Cedet-devel@...
>>>>> https://lists.sourceforge.net/lists/listinfo/cedet-devel
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> All of the data generated in your IT infrastructure is seriously valuable.
>>> Why? It contains a definitive record of application performance, security
>>> threats, fraudulent activity, and more. Splunk takes this data and makes
>>> sense of it. IT sense. And common sense.
>>> http://p.sf.net/sfu/splunk-d2d-c2
>>> _______________________________________________
>>> Cedet-devel mailing list
>>> Cedet-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/cedet-devel
>>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> Cedet-devel mailing list
> Cedet-devel@...
> https://lists.sourceforge.net/lists/listinfo/cedet-devel
|