[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Netscape Navigator not displaying emdash

Subject: Re: Netscape Navigator not displaying emdash
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Thu, 21 Dec 2000 15:08:04 -0800
url
Does this do what you need?

Here's the xsl template for the generic search-and-replace functionality.

Below that is a URL-encoding template that uses a predefined list of
search and replace strings and uses the search-and-replace template.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++  generic search and replace  +++++++++++++++++


<!-- sample how to use generic search-and-replace: -->
<xsl:variable name="string" select="'string to be
searched-and-replaced'"/>
<xsl:variable name="find"
select="'stringfragment-that-has-to-be-replaced'"/>
<xsl:variable name="replace"
select="'the-replacement-stringfragment'"/>
<xsl:call-template name="_replace_string">
<xsl:with-param name="string"
select="substring-after($string,$find)"/>
<xsl:with-param name="find" select="$find"/>
<xsl:with-param name="replace" select="$replace"/>
</xsl:call-template>



IN STYLESHEET:

<!-- template to look for all instances of string $find and
replace that with string $replace -->
<xsl:template name="_replace_string">
<xsl:param name="string" select="''"/>
<xsl:param name="find" select="''"/>
<xsl:param name="replace" select="''"/>
<xsl:choose>
<xsl:when test="contains($string,$find)">
<xsl:value-of
select="concat(substring-before($string,$find),$replace)"/>
<xsl:call-template
name="_replace_string">
<xsl:with-param name="string"
select="substring-after($string,$find)"/>
<xsl:with-param name="find"
select="$find"/>
<xsl:with-param name="replace"
select="$replace"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++  URL-ENCODING  ++++++++++++++++++++++++

<!-- sample how to use url-encoding template: -->
<xsl:call-template name="_url_encode">
<xsl:with-param name="url" select="@url"/>
</xsl:call-template>


IN STYLESHEET:

<!-- select the find-replace strings that are defined in a
separate xml document -->
<xsl:variable name="url-enc_search"

select="document('_lookup.xml')/lookup/url-encoding/search"/>

<!-- URL encoding template -->

<xsl:template name="_url_encode">
<xsl:param name="url" select="''"/>
<xsl:param name="search_element_nr" select="'1'"/>
<xsl:variable name="encoded_url">
<xsl:call-template name="_replace_string">
<xsl:with-param name="string"
select="$url" />
<xsl:with-param name="find"

select="$url-enc_search[$search_element_nr]/@find"/>
<xsl:with-param name="replace"

select="$url-enc_search[$search_element_nr]/@replace"/>
</xsl:call-template>
  </xsl:variable>
<xsl:choose>
<xsl:when test="$search_element_nr &lt;
count($url-enc_search)">
<xsl:call-template name="_url_encode">
<xsl:with-param name="url"
select="$encoded_url" />
<xsl:with-param
name="search_element_nr" select="$search_element_nr + 1" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$encoded_url"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


=================================================

FILE _LOOKUP.XML FOR URL-ENCODING:

<?xml version="1.0" encoding="UTF-8"?>
<lookup>
<url-encoding>
<search find="~" replace="%7E"/>
<search find="?" replace="%3F"/>
<search find="&amp;" replace="%26"/>
<search find="#" replace="%23"/>
<search find=":" replace="%3A"/>
<search find="=" replace="%3D"/>
<search find="@" replace="%40"/>
<search find=" " replace="%20"/>
<search find="," replace="%2C"/>
<search find="/" replace="%2F"/>
<search find="\" replace="%5C"/>
</url-encoding>
</lookup>


----- Original Message -----
From: "Eric van der Vlist" <vdv@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, December 20, 2000 2:00 AM
Subject: Re:  Netscape Navigator not displaying emdash


> Dylan Walsh wrote:
> >
> > I have a different suggestion from the others: Use the XML output mode
in
> > your stylesheet. Seen as
> > the HTML output mode is the one that replaces &#x2014 with &mdash;, this
> > should not happen in XML mode.
> >
> > You'll be generating a sort of XHTML (really it is just well-formed
HTML).
> > There are some compatibility tricks on the W3C site for older browsers
e.g.
> > putting a space in empty tags e.g. "<br />" instead of "<br/>".
>
> Sure, but there are no standard ways to control that either from XSLT :)
> ...
>
> Eric
> --
> ------------------------------------------------------------------------
> Eric van der Vlist       Dyomedea                    http://dyomedea.com
> http://xmlfr.org         http://4xt.org              http://ducotede.com
> ------------------------------------------------------------------------
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.