By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

XSL: inline tags

P: n/a
Xtr
Hello,

Is it possible, using xsl, to indent most tags, but preserve the
position of tags that are inline (surrounded by text)?

For example, given the following,:

<text><p>text<b>text</b></p></text>
<text><p>text<b>text</b></p></text>

have it output like this:

<text>
<p>text<b>text</b></p>
</text>
<text>
<p>text<b>text</b></p>
</text>

Can this, for example, be done by using indent="yes" and using some
kind of exception for certain tags?

Thanks.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a


Xtr wrote:
Is it possible, using xsl, to indent most tags, but preserve the
position of tags that are inline (surrounded by text)?

For example, given the following,:

<text><p>text<b>text</b></p></text>
<text><p>text<b>text</b></p></text>

have it output like this:

<text>
<p>text<b>text</b></p>
</text>
<text>
<p>text<b>text</b></p>
</text>

Can this, for example, be done by using indent="yes" and using some
kind of exception for certain tags?


If you use indent yes and <xsl:output method="html"> then the XSLT
processor usually does try to keep text in HTML containers like <p> ir
HTML inline elements like <b> as it is output in the result elements.
With output method xml it is usually not clear to a processor what the
semantics of your <p> or <b> elements is.

--

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

Jul 20 '05 #2

P: n/a
Xtr
Martin Honnen <ma*******@yahoo.de> wrote in message news:<40********@olaf.komtel.net>...
Xtr wrote:
Is it possible, using xsl, to indent most tags, but preserve the
position of tags that are inline (surrounded by text)?

For example, given the following,:

<text><p>text<b>text</b></p></text>
<text><p>text<b>text</b></p></text>

have it output like this:

<text>
<p>text<b>text</b></p>
</text>
<text>
<p>text<b>text</b></p>
</text>

Can this, for example, be done by using indent="yes" and using some
kind of exception for certain tags?


If you use indent yes and <xsl:output method="html"> then the XSLT
processor usually does try to keep text in HTML containers like <p> ir
HTML inline elements like <b> as it is output in the result elements.
With output method xml it is usually not clear to a processor what the
semantics of your <p> or <b> elements is.


I need to output to plain XML. What would solve my problem would be a
way to specify certain element-types that should always be inline
within the parent element.

I guess it would be possible to create a "function" in XSLT that
parses every element and indents the element based on its position or
"layer" within the xml-file. This function would then indent some
elements and put some inline.

However, if it is possible to use indent="yes", I would rather like to
do that to keep things simple.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.