Edgewall Software

Ticket #102 (new enhancement)

Opened 7 years ago

Last modified 4 years ago

[PATCH] xi:include and fragments

Reported by: anonymous Owned by: cmlenz
Priority: major Milestone:
Component: Template processing Version: 0.3.6
Keywords: Cc: martin.marcher@…, nicoe@…

Description

At the moment it is not possible to use <xi:include href="somefile.html" /> to only get a certain subtag of the file.

I suggest something like:

input.html

<bookstore>
    <books>
        <book class="scifi">
            <title>StarTrek</title>
            <title>Babylon 5</title>
            <title>The Blob</title>
        </book>
        <book class="technical">
            We don't have any technical books yet
        </book>
        <book class="scifi" restriction="adult">
            There are no books here yet
        </book>
    </books>
</bookstore>
  • Using <xi:include /> NOTE: I don't know anything about the xi:include specs
    <document>
        <xi:include href="input.html" xpath="//books[@class='scifi'] />
    <document> 
    
  • Using <py:xpath path="..." />
    <document>
        <py:xpath path="//books[@class='scifi']>
            <xi:include href="input.html" xpath="//books[@class='scifi'] />
        </py:xpath>
    </document>
    

* Note the difference to py:match is that just the part inside py:xpath is processed and only matching attributes are placed multiple xpath matches could be defined like this: ` <py:xpath path="//book[@class='scifi'];//book[@class=]/@text" /> `

  • Result
    <document>
        <book class="scifi">
            <title>StarTrek</title>
            <title>Babylon 5</title>
            <title>The Blob</title>
        </book>
        <book class="scifi">
            There are no books here yet
        </book>
    </document>
    

Attachments

xpointer.diff Download (5.9 KB) - added by nicoe@… 6 years ago.
A patch for a naive support of xpointer
xpointer_xpath.diff Download (6.2 KB) - added by nicoe@… 6 years ago.
A less naïve implementation (including xpointer xpath support)

Change History

Changed 7 years ago by cmlenz

  • type changed from defect to enhancement
  • component changed from General to Template processing
  • milestone 0.4 deleted

Would be nice, but not for 0.4.

Changed 7 years ago by anonymous

how to add xi:include tag in xml document using msxml api. I am working in vc++ environment and my application back end is xml file. I need to edit this xml file using vc++ environment and some api's to add xi:include tag in it

thanks in advance chandu

Changed 7 years ago by cmlenz

Please ask such questions on the MailingList.

Changed 6 years ago by nicoe@…

  • cc nicoe@… added

As it can be seen in the  XInclude spec there is an attribute that do just that xpointer.

Unfortunately genshi does not support it yet (after a quick glance at the source).

Changed 6 years ago by nicoe@…

A patch for a naive support of xpointer

Changed 6 years ago by nicoe@…

A less naïve implementation (including xpointer xpath support)

Changed 6 years ago by nicoe@…

Is there anything preventing those patch to be included ?

Changed 5 years ago by dfraser

  • summary changed from xi:include and fragments to [PATCH] xi:include and fragments

Changed 4 years ago by anonymous

what is the status of this?

Add/Change #102 ([PATCH] xi:include and fragments)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cmlenz. Next status will be 'new'
The owner will change from cmlenz to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.