xsl-list
[Top] [All Lists]

Re: [xsl] Replacing substring with value during transform

2012-09-13 08:12:54
John English wrote:

  Hi,

   <td align='center' valign='middle'>
     <xsl:value-of select='@date'/>
     <br />
     {#User#}: <xsl:value-of select='@user'/>
   </td>
   <td align='right' valign='middle' width='30%'>
     <a class='boxed' href='logout'>{#Logout#}</a>
   </td>

  Sorry I don't have time to look at your own question, but just to
mention that in such a case, if you have control over that format, I'd
strongly adive to use XML elements instead, something like:

   <td align="center" valign="middle">
      <xsl:value-of select="@date"/>
      <br/>
      <my:user/>: <xsl:value-of select="@user"/>
   </td>
   <td align="right" valign="middle" width="30%">
      <a class="boxed" href="logout"><my:logout/></a>
   </td>

or like:

   <td align="center" valign="middle">
      <xsl:value-of select="@date"/>
      <br/>
      <my:text name="user"/>: <xsl:value-of select="@user"/>
   </td>
   <td align="right" valign="middle" width="30%">
      <a class="boxed" href="logout"><my:text name="logout"/></a>
   </td>

  Basically, {#User#} is replaced by <user/> or by <text name='user'/>
which also allows to add "parameters" to internationalized parts in a
natural way.

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>