Hi,
I'm just getting going with xml and xslt. I'm trying to write what are
essentially man pages and I need 3 output formats.
1) nroff -man format for real man pages
2) html for an online help browser
3) ascii where every line must start with a '%' character (octave
online help).
So, I made a simple DTD, a simple man page in xml format and hacked up
some .xsl files.
I've more or less got something working for #1 and #2. The .xsl file
for #3 is proving to be a real pain. I'm using <xsl:output
method="text"/>. Is there some way to force every line in the output
file to start with a %? Or maybe I'm doing this the wrong way.
Perhaps I should output html and use something like
xsltproc foo.xsl bar.xml | lynx -dump - | awk '{printf("% %s\n",
$0)}' > bar.m
Any comments? Is this the sort of thing that xml and xslt are meant
for or am I really using the Wrong Tool?
Thanks
-Dan 3 1742
"danmc91" <sp**@mcmahill. net> writes: 3) ascii where every line must start with a '%' character (octave online help).
I've more or less got something working for #1 and #2. The .xsl file for #3 is proving to be a real pain. I'm using <xsl:output method="text"/>. Is there some way to force every line in the output file to start with a %?
I had to do this recently, and decided to output text with one long
line per paragraph (or so), then use fmt[*] to properly reformat
something that had to be kept in the 80-column limit.
xsltproc foo.xsl bar.xml | lynx -dump - | awk '{printf("% %s\n", $0)}' > bar.m
If your only problem is to prepend '% ' to all lines, you could use :
xsltproc ... | sed 's/^/% /'
-- Alain.
[*] : weel, not really fmt, but a self-maid tool whose only purpose
was to properly reformat some parts of the document.
danmc91 wrote: Hi,
I'm just getting going with xml and xslt. I'm trying to write what are essentially man pages and I need 3 output formats.
1) nroff -man format for real man pages
2) html for an online help browser
3) ascii where every line must start with a '%' character (octave online help).
So, I made a simple DTD, a simple man page in xml format and hacked up some .xsl files.
I've more or less got something working for #1 and #2. The .xsl file for #3 is proving to be a real pain.
The assumption in most projects like this is that the output from
XML-->XSLT will be postprocessed by a formatter. This is true in
(1) nroff and (2) browser, but false for (3) because (my understanding
is that) Octave requires preformatted text -- in other words something
else has to do the formatting.
I'm using <xsl:output method="text"/>. Is there some way to force every line in the output file to start with a %? Or maybe I'm doing this the wrong way. Perhaps I should output html and use something like
xsltproc foo.xsl bar.xml | lynx -dump - | awk '{printf("% %s\n", $0)}' > bar.m
Any comments? Is this the sort of thing that xml and xslt are meant for or am I really using the Wrong Tool?
You are absolutely right to be using XML to store the document, and to
use XSLT to output it to other formats for (1) and (2). Your solution
to (3) is one good way to do it. Alain posted another.
I suspect you *could* do it in XSLT, by buffering the output and slicing
it at (eg) 65 characters, but it would be a pain to code.
If you wanted to make a better shot at smoothing out the ragged right
margin caused by Octave using a proportional font to display text which
Lynx had formatted on the basis of a monospace font, I guess you could
output LaTeX and dvi2tty, but that has severe problems with anything
other than the 95 printable characters of ASCII.
///Peter
ok. Thanks for the replies. I think what I'll do for #3 is to
generate html then
x3m -dump foo.html | awk '{print "% " $0}' > foo.m
That seems to work well, and as you point out nroff and html viewers
both fill the roll of formatting the data for viewing.
Now I just need to get more proficient in xslt programming. Seems like
there are many ways to get to the same answer but some may be much
cleaner than others. I have something working but boy do I feel like
there are a lot of details I don't quite understand.
-Dan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christian Roth |
last post by:
Hello,
when using this "identity" processing sheet:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="iso-8859-1" />
<xsl:template match="@*|node()">
|
by: Mark247 |
last post by:
Hi,
When transforming an XSLT to HTML I get a very annnoying white spac
gap of about 2px under each image. This is particularly annoying as
am creating a vertical navigation menu made up of images wit
rollovers. I know why the space is there, I just dont know how t
remedy the problem in my XSLT. The space is caused by the transforme
HTML closing </a> being on the next line from the closing </img> ta
and the closing </td> on the next line...
|
by: bjam |
last post by:
Hi,
I am hoping someone can help with this I am assuming it is pretty
basic but I don't see anything that jumps out at me at how to do this.
Is there a way to have all the items output from the style sheet appear
as a single line with no return chars?? When executing the following
style sheet, how can I concatenate the values together in a single
line, in this case a single line would be how the browser displays
this, but I want the...
|
by: Grant Harmeyer |
last post by:
Ok:
I have done small level Xml stuff and am just now starting to understand
some of the plumbing involved. I've done a lot of .NET programming for SQL
Server, but little for Xml data stores.
I am currently just interested in using the .xsl file that I have being
applied to a source .xml file through ASP classic. Here's what I have:
XSL file
|
by: Lionel Fourquaux |
last post by:
In .Net 1.1, System.Xml.Xsl.XslTransform cannot output directly a document
in an encoding that cannot represent all the characters used (e.g. write in
us-ascii for compatibility, and convert all non-ascii chars to entities).
While it can be worked around (by defining a TextWriter that does the
conversion to entities), it's not very elegant (because the information on
encodings must be duplicated outside the XSLT file) and breaks...
| |
by: crc128 |
last post by:
Hi, I'm looking at using XML and XSLT with apache cocoon to
automatically generate html files for a site. the problem I'm having
is that I want one of the pages to display a google map, but the google
API requires the following line in the output HTML:
<script src="http://maps.google.com/maps?file=api&v=2&key=abcdefg"
type="text/javascript">
The problem is that I can't get the '&' to properly make it into the
result. I can get &. ...
|
by: cmay |
last post by:
I am having this problem...
Lets say that your source XML is formatted like this:
<somenode>
Here is some text
Here is some more text
</somenode>
When to a <xsl:value-of select="somenode" /I want the output to be
free of the tabs that are included in the source XML.
These tabs are not really part of the content, but rather just there
|
by: qbp90x5lb |
last post by:
I'm using an XSLT transform to output the element value contents from a simple XML file into a new .TXT file. Everything works fine except for certain XML files, when calling msxsl with the .xslt, I get the following error:
Code: 0xc00ce504
File: ......
Line: ...
Column: ...
A name was started with an invalid character.
The error refers to the '<' found in the string "<20" from my example xml file below (a).
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
|
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...
| |
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |