This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > October 2004 > Displaying each attribute on a different line





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Displaying each attribute on a different line
Ben Goh

2004-10-30, 4:14 am

Good day everyone, I have problem understanding XSL for now. Can anyone lend
me a helping hand? I want to display each attribute on a new line, how should
my XSL look like?

For an example, instead of this...

<Book Name="Inside D3D" ISBN="0-7356-0613-7" Publisher="MS Press" />

I hope to represent it this way...

<Book
Name="Inside D3D"
ISBN="0-7356-0613-7"
Publisher="MS Press" />

Thanks for any help that I might get :)

Martin Honnen

2004-10-30, 12:14 pm



Ben Goh wrote:


> I want to display each attribute on a new line, how should
> my XSL look like?
>
> For an example, instead of this...
>
> <Book Name="Inside D3D" ISBN="0-7356-0613-7" Publisher="MS Press" />
>
> I hope to represent it this way...
>
> <Book
> Name="Inside D3D"
> ISBN="0-7356-0613-7"
> Publisher="MS Press" />


XSLT doesn't really help (unless you find an XSLT processor that has a
setting to serialize that way. If you are using .NET then check the
messages of the last weeks, Oleg showed you to extend XmlTextWriter in .NET:
http://groups.google.com/groups?hl=...lr%3D%26hl%3Den

--

Martin Honnen
http://JavaScript.FAQTs.com/
Ben Goh

2004-10-30, 12:14 pm

Thanks Martin, I'm sure that code works well. But I'm not using .NET, I'm
currently using VC++ to do it. Is it possible to put a new line character
with XSL (output as XML document)?

That's possible with HTML I guess, with those HTML tags, but not sure if
there's any equivalent in XML... MS VS.NET is doing line break in its project
files.


"Martin Honnen" wrote:

>
>
> Ben Goh wrote:
>
>
>
> XSLT doesn't really help (unless you find an XSLT processor that has a
> setting to serialize that way. If you are using .NET then check the
> messages of the last weeks, Oleg showed you to extend XmlTextWriter in .NET:
> http://groups.google.com/groups?hl=...lr%3D%26hl%3Den
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/
>

Martin Honnen

2004-10-30, 12:14 pm



Ben Goh wrote:


> Is it possible to put a new line character
> with XSL (output as XML document)?


As said, XSLT doesn't really allow that between attribute nodes, it
operates on trees with different nodes and then has some rules and
options (e.g.
<xsl:output method="xml" indent="yes" />
) to serialize that tree but XSLT 1.0 does't have any options to
serialize attributes on different lines. There might be XSLT processors
which have such options as extensions to XSLT 1.0, you would need to
check the documentation of such processors.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Ben Goh

2004-10-31, 12:14 pm

Thanks Martin, I guess that's an insignificant so I'm givin' up on the idea.
At most I'll write my own serializer the next time I'm free.


"Martin Honnen" wrote:

>
>
> Ben Goh wrote:
>
>
>
> As said, XSLT doesn't really allow that between attribute nodes, it
> operates on trees with different nodes and then has some rules and
> options (e.g.
> <xsl:output method="xml" indent="yes" />
> ) to serialize that tree but XSLT 1.0 does't have any options to
> serialize attributes on different lines. There might be XSLT processors
> which have such options as extensions to XSLT 1.0, you would need to
> check the documentation of such processors.
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/
>

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews