Subject: RE: [xsl] string replace with ­ From: "Miller, James V (CRD)" <millerjv@xxxxxxxxxx> Date: Fri, 2 Nov 2001 16:46:00 -0500 |
Either of these is fine with me. I am just trying to allow the browser to break the string "machine.site.domain" at the '.' over a line-end. If there is a hyphenless way to do this, that would be great. This content is inside of a table element and am I just trying to give the browser an opportunity to reformat the string. Here is a page that I have formatted like this http://public.kitware.com/Insight/Testing/HTML/TestingResults/Dashboard/20011102-Nightly/Dashboard.ht ml I would also like allow the browser to break lines at a "/". I am building a table where one of the columns has text in the form of ./Testing/Code/Common/foo.cxx Some of these filenames are very very long. Again, I would like browser to have the freedom to break a line at a "/". The template below works fine when I pass it the content from an element. However, the template seems to produce bad when I pass it the value of an attribute. Is there a difference in what is returned by xsl:value-of when called for an element vs an attribute? As a concrete example, the attribute value ./Common/Testing/Cxx/ObjectFactory.cxx should have been translated to .­/Common­/Testing­/Cxx­/ObjectFactory.cxx but becomes .A-/CommonA-/TestingA-/CxxA-/ObjectFactory.cxx <xsl:template name="SoftHyphenStringAtSlash"> <xsl:param name="src"/> <xsl:choose> <xsl:when test="contains($src, '/')"> <xsl:value-of select="concat(substring-before($src, '/'), '­/')"/> <xsl:call-template name="SoftHyphenStringAtSlash"> <xsl:with-param name="src"><xsl:value-of select="substring-after($src, '/')"/></xsl:with-param> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$src"/> </xsl:otherwise> </xsl:choose> </xsl:template> -----Original Message----- From: Peter Flynn [mailto:peter@xxxxxxxxxxx] Sent: Friday, November 02, 2001 4:09 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] string replace with ­ Miller, James V (CRD) wrote: > I have an XML file that I am converting to HTML. In the processing, I have a string of the form > "machine.site.domain". These strings can be fairly long. When I output the HTML, I would to add a > hint to the browser that it can hyphenate this string at any ".". So when I output the string I > would like it to be > > machine­.site­.domain > > So that it can be rendered as > > machine- > .site.domain David has answered your question, but can I ask why you want to do this this way? It will be very misleading to your readers: the normal way to break URLs over a line-end is to use a hyphenless break at punctuation points only. My personal preference is to leave the punctuation at the end of the line, but I know some editors prefer the punctuation at the start of the next line, eg machine. site.domain or machine .site.domain But I urge you to use one of them and not introduce additional characters which are not part of the name but could be misunderstood by the unwary. ///Peter 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] string replace with ­, David Carlisle | Thread | Re: [xsl] string replace with ­, Peter Flynn |
Re: [xsl] string replace with ­, David Carlisle | Date | Re: [xsl] string replace with ­, Peter Flynn |
Month |