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

Re: Re: Check if text is before an tag or not

Subject: Re: Re: Check if text is before an tag or not
From: "Sebastien deprez" <sebastien.deprez@xxxxxxxxxx>
Date: Thu 13 Nov 2003 09:48:02 +0100
xsl if text
Hi Jeni (and other helpers),

thanks alot for your help!!

everything works just perfect now!
And... I have still another week left...whiiii...

This worked (if other people like to know how it works):
<xsl:template match="title">
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="name">
  <xsl:variable name="nrEntrada"
                select="ancestor::itemInv/@n" />
  <a href="JavaScript:authorWindow('{$inventario}',{$nrEntrada});"
     class="linkAuthor">
    <xsl:value-of select="." />
  </a>
</xsl:template>

<xsl:template match="title/text()[1]">
  <xsl:value-of select="." />
  <xsl:if test="following-sibling::name"> - </xsl:if>
</xsl:template>

<xsl:template match="title/text()[last()]">
  <xsl:if test="preceding-sibling::name"> - </xsl:if>
  <xsl:value-of select="." />
</xsl:template>

And indeed, like you said whitespace and punctuation is a matter for the XML-editor itself. I'll tell him :-D.

To bad I don't know you, but I'd buy you all a drink!

Thanks alot!!!

Greetings
Sebastien Deprez

ps: the $inventario is a parameter given to the xsl, so nothing to worry about ;-).
it's the inventory-nummer (cause there are more then one ;-))
------------------------
 xsl-list@xxxxxxxxxxxxxxxxxxxxxx wrote:
------------------------
	
>Hi Sebastien,
>
>> XML:
>>
>> 
>>    
>>      fol. 13v 
>>      
>>      Séneca 
>>      y 
>>      Cicerón 
>>       en castellano de los oficios 
>>       
>>     
>> 
>[snip]
>> The output should be:
>> Séneca y Cicerón - de los oficios
>
>It's not clear how this output is derivable from the XML that you've
>given above. How do you know to only output "de los oficios" and not
>"en castellano de los oficios"?
>
>The obvious output from the above XML is:
>
>  Séneca y Cicerón en casstellano de los oficios
>
>(with the names clickable). You can get this with something like:
>
>
>  
>
>
>
>  
>  
>    
>  
>
>
>(Note that I'm not sure where the value of $inventario comes from.)
>
>It sounds as though you want a hyphen to be added after the first text
>node in  if it's got a following  sibling, and before the
>last text node in  if it's got a preceding  sibling. You
>can do this with the following two templates:
>
>
>  
>   - 
>
>
>
>   - 
>  
>
>
>This will give you (roughly):
>
>  Séneca y Cicerón - en casstellano de los oficios
>
>(Personally I think it's good practice to have mixed content contain
>exactly the punctuation and whitespace that you want to have, rather
>than letting it be added by a stylesheet later. Rules for adding
>punctuation and whitespace in mixed content are horrible to maintain.)
>  
>Cheers,
>
>Jeni
>
>---
>Jeni Tennison
>http://www.jenitennison.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.