Edgewall Software

Opened 17 years ago

Last modified 13 years ago

#102 new enhancement

[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 (2)

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

Download all attachments as: .zip

Change History (9)

comment:1 Changed 17 years ago by cmlenz

  • Component changed from General to Template processing
  • Milestone 0.4 deleted
  • Type changed from defect to enhancement

Would be nice, but not for 0.4.

comment:2 Changed 17 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

comment:3 Changed 17 years ago by cmlenz

Please ask such questions on the MailingList.

comment:4 Changed 16 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 15 years ago by nicoe@…

A patch for a naive support of xpointer

Changed 15 years ago by nicoe@…

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

comment:5 Changed 15 years ago by nicoe@…

Is there anything preventing those patch to be included ?

comment:6 Changed 15 years ago by dfraser

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

comment:7 Changed 13 years ago by anonymous

what is the status of this?

Note: See TracTickets for help on using tickets.