473,782 Members | 2,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>tex t</b></p>
</text>
<text>
<p>text<b>tex t</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 2775


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>tex t</b></p>
</text>
<text>
<p>text<b>tex t</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*******@yaho o.de> wrote in message news:<40******* *@olaf.komtel.n et>...
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>tex t</b></p>
</text>
<text>
<p>text<b>tex t</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
2158
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.25 Problem : i am using apache fop 0.25 and i used the below to set a gif as background and alignment to be center...
0
1291
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 proper XSL-FO syntax. This is <fo:inline font-weight="bold">
0
2432
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 <fo:layout-master-set> <fo:simple-page-master margin-left="0.5in" margin-right="0.5in" page-width="8.5in" margin-bottom="0.5in" master-name="Section-odd-page" margin-top="0.5in" page-height="14in"> <fo:region-after region-name="xsl-region-after-odd"
3
2906
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 these elements that should have a self-closing tag like this: <img src="/images/img.jpg" alt="alt text"></img> should be: <img src="/images/img.jpg" alt="alt text" />
4
1602
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> <SPECIAL1>abc</SPECIAL1> <SPECIAL2>abc</SPECIAL2> ... <SPECIAL12>abc</SPECIAL9>
0
1321
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> <SPECIAL1>abc</SPECIAL1> <SPECIAL2>abc</SPECIAL2> ... <SPECIAL12>abc</SPECIAL9>
1
1726
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. The solution i got today is very slow, and i need help to find another solution. Here is the xml file. It consists of a list of position ids (ESTOXX50 INDEX_BM_E and FTSE INDEX_BM_E), and below that a list of tags for each position id. What i...
1
1705
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 I want to replace all headings, I could do for each heading level (i.e. repeat the following code for h2, h3, h4, h5, etc.): <xsl:template match="h1"> <h1><xsl:apply-templates/></h1> </xsl:template>
0
1480
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 me i will appreciatte : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:fox="http://xml.apache.org/fop/extensions" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.