lxml and adding a stylesheet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sean Davis

    lxml and adding a stylesheet

    I have an xml document and simply need to add an xml-stylesheet to
    it. I am using lxml to parse the xml document and then would like to
    insert the xml-stylesheet tag using the etree api. Any suggestions?

    Thanks,
    Sean
  • Stefan Behnel

    #2
    Re: lxml and adding a stylesheet

    Sean Davis wrote:
    I have an xml document and simply need to add an xml-stylesheet to
    it. I am using lxml to parse the xml document and then would like to
    insert the xml-stylesheet tag using the etree api. Any suggestions?
    I assume you are talking about a processing instruction here, not a tag.

    Use the .addprevious() method on the root Element with a PI object.

    Stefan

    Comment

    Working...