Subject: Re: [xsl] preserve structure of input XML file From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 18 May 2011 11:54:32 -0400 |
Cheers, Wendell
Another question is what is your output?
As Wendell points out, if your output is XML, whitespace is usually preserved. But if you're trying to generate HTML from an XML element like:
<abstract> The primary parameters measured in this dataset are: - temperature - wind speed - humidity
The units are:
Temperature Wind Speed Humidity ============================== degrees C km/h percent
Global Attributes of level 1a datasets are: Mission and Documentation, Data Time, Data Quality, File Metrics, and Scene Coordinates. Vgroups included in the dataset are Scan-Line Attributes, Raw SeaStar Data, Converted Telemetry, Navigation, Sensor Tilt, and Calibration. Of the six Vgroups, four Vgroups, Scan-Line At tributes, Raw SeaStar Data, Converted Telemetry, and Navigation, contain data that are functions of scan lines. <abstract>
and your XSLT does:
<p><xsl:value-of select="abstract"><p>
Any HTML browser would collapse all your significant whitespace, losing the indenting and the table, squishing everything together into an unreadable mess.
If you simply used <pre>...</pre> instead, then you'd keep the indenting and table, but the final paragraph would scroll endlessly to the right, rather than wrapping with the window size.
If this is your problem, you might consider using our printFormatted.xsl template which tries to guess the intent of the author, and preserve whitespace when it finds consecutive spaces and tabs, but outputs as an ordinary paragraph otherwise:
http://www.ngdc.noaa.gov/metadata/published/views/xml2text/xml-to-text-ISO.xsl
which imports:
http://www.ngdc.noaa.gov/metadata/published/views/xml2text/printFormatted.xsl
We've found it to work reasonably well on many different combinations of whitespace.
! or ? --Rich
Richard Fozzard, Computer Scientist Geospatial Metadata at NGDC: http://www.ngdc.noaa.gov/metadata
Cooperative Institute for Research in Environmental Sciences (CIRES) Univ. Colorado & NOAA National Geophysical Data Center, Enterprise Data Systems 325 S. Broadway, Skaggs 1B-305, Boulder, CO 80305 Office: 303-497-6487, Cell: 303-579-5615, Email: richard.fozzard@xxxxxxxx
-- ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] preserve structure of inp, Richard Fozzard | Thread | [xsl] distinct values by xslt, JS Rawat |
Re: [xsl] distinct values by xslt, Syd Bauman | Date | Re: [xsl] distinct values by xslt, Wendell Piez |
Month |