473,382 Members | 1,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

XSL: inline tags

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
2 2758


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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philip Meyer | last post by:
1) setting image as Background with alignment in center not working..help Explanation : i need to set a image as background and also it should be dispalyed in the center.i am using apache fop...
0
by: slberry | last post by:
I have a client sending me XML where there are formatting tags embedded in XML entities.... i.e. <p content="This is &lt;B&gt;bold, and &lt;I&gt;bold-italic&lt;/I&gt;&lt;/B&gt;"/> I need to convert the entity to the...
0
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
3
by: Martin Olson | last post by:
I'm trying to output valid xhtml 1.0 transitional with xslt -- my question is when dealing with elements that have self-closing tags such as <img /> and <input />... I'm getting closing tags on...
4
by: Piper707 | last post by:
I need help with using a general template which would process all tags other than the ones for which specific templates have been written. My XML looks like this: <ITEMS>...
0
by: Piper707 | last post by:
I need help with using a general template which would process all tags other than the ones for which specific templates have been written. My XML looks like this: <ITEMS>...
1
by: sommarlov | last post by:
Hi everyone >From one of our systems an xml file is produced. I need to validate this file before we send it to an external system for a very lenghty process. I cannot change the xml file layout....
1
by: Izhaki | last post by:
Hi, I'm creating a system where my XML includes HTML tags (<h1></h1>) in addition to other XML elements (<book></book>). I would like to render the HTML tags back to HTML using XSL. Considering...
0
by: zamba | last post by:
hi im new with xsl and i have to process a xsl with a lot of xml (about 50.000) the transform is slow ..and i want to optimize my xsl . here is the example so if anybody could give some advices to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.