Re: [Visual-XSLT-discuss] Formatting/pretty-printing xml/xsl in the editor
by Taras Tielkes other posts by this author
Jan 7 2003 8:48PM messages near this date
view in the new Beta List Site
Re: [Visual-XSLT-discuss] Formatting/pretty-printing xml/xsl in the editor
|
Re: [Visual-XSLT-discuss] Formatting/pretty-printing xml/xsl in the editor
Hi Eric,
Two remarks:
1) When I try this on the following xslt document
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>
.., the result is:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
</xsl:template>
</xsl:stylesheet>
Eg., template element children of the stylesheet element are not
indented.
2) Would it be possible to add auto-formatting for source XML
documents to the next version?
Actually, I think it makes much more sense to have this for XML than
for XSLT since you're usually in control of the XSLT yourself, while
sometimes the source XML is machine-generated.
What's the reason for the formatting limitation you mentioned? It
would be very easy to implement a formatter without such a limitation
by just having a visitor traverse the parsed xml. Indeed, a XSLT sheet
can be written that does this in a couple of lines.
Regards,
tt
> Pretty-printing should work. Simply select the XML or XSLT,
> and run the Edit|Advanced|Format Selection (Ctrl-K Ctrl-F) command.
> This only works in an XSLT edit window, not an XML edit window.
> But it will work on any kind of XML text, not just XSLT.
>
> One thing this command won't do is separate two contiguous tags
> on the same line, as in
>
> <element_1_with_lots_of_attributes a1='v1' ...
a1000='v1000'> <element_2 ...>
>
> For this, you need to do a search-and-replace of '\>\<' with
> '>\n< with selection on before carrying out the Format command.
> I think this could easily be automated with a macro to call the
> two commands, something like:
>
> Edit.Replace "\>\<", ">\n", /r, /sel
> Edit.FormatSelection
>
> - Eric
>
> On Tue, Jan 07, 2003 at 08:54:51PM +0100, Taras Tielkes wrote:
> > Hi,
> >
> > Is it possible to auto-format (eg. pretty-print) xml (or xsl) in
the
> > Visual XSLT 1.6 editor?
> >
> > Sometimes I paste (messy, unformated) program-generated xml into
the
> > editor window, and it would really help to have such a command.
> >
> > Regards,
> >
> > tt
> >
> > _______________________________________________
> > Visual-XSLT-discuss mailing list
> > Visual-XSLT-discuss@[...].com
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
Thread:
Taras Tielkes
Taras Tielkes
Taras Tielkes
Eric Promislow
Eric Promislow
Stuart Celarier
|