Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: xml::twig and stylesheets

by Tanktalus (Canon)
on Mar 23, 2006 at 14:57 UTC ( [id://538755]=note: print w/replies, xml ) Need Help??


in reply to Re^3: xml::twig and stylesheets
in thread xml::twig and stylesheets

Stylesheets aren't the only thing I've seen outside of root. To be honest, the way that rogue90 showed is the most intuitive manner to me. If XML::Twig could detect that the request is before the root AND the request is for a comment or a processing instruction, then just call the _add_cpi_outside_of_root function. Or if the request is after the root AND the request is for a PI, then do the same. (Comments after root allowed? I'm not sure.)

Having an add_stylesheet method would then merely be a convenience method to wrap all that up. But it wouldn't limit the user to just one type of PI outside of root.

Note that the way I've done this type of thing in the past is to read the XML file, add <root>...</root> tags around it, do my massaging, and then return $twig->root()->sprint($t->root(), 1) to get rid of the actual root tags. That can be ugly, too ;-)

Replies are listed 'Best First'.
Re^5: xml::twig and stylesheets
by mirod (Canon) on Mar 23, 2006 at 16:11 UTC
    If XML::Twig could detect that the request is before the root AND the request is for a comment or a processing instruction, then just call the _add_cpi_outside_of_root function. Or if the request is after the root AND the request is for a PI, then do the same. (Comments after root allowed? I'm not sure.)

    It makes sense, I'll do just that (yes comments are allowed after the root, it's in the first production rule in the spec, the Misc after the element).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://538755]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-03-29 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found