Altova Mailing List Archives


RE: [xsl] A question of style

From: "Whitney, Dan (Canwest Digital Media)" <DWhitney@-------.--->
To: <xsl-list@-----.------------.--->
Date: 7/27/2010 7:49:00 PM
I apologize for the multiple postings. Not sure what's going on here, but I send it once and it seems to duplicate the message.

Dan


-----Original Message-----
From: Whitney, Dan (Canwest Digital Media) [mailto:DWhitney@c...] 
Sent: Tuesday, July 27, 2010 3:45 PM
To: xsl-list@l...
Subject: RE: [xsl] A question of style

Thanks Andrew, That was fast. 

Forgive my ignorance ....
I understand what's going on in the first scenario, however I'm confused by the second (I assume this is version 2.0 XSL with which I'm woefully unfamiliar).

For scenario 2 
1. There's a variable "content" that contains some text and an empty var1 element. 
2. There's a template that matches the var1 element and "replaces" the empty var1 element with "fill in the blanks"
3. I assume <xsl:apply-templates select="$content"/> processes\outputs the text with the results of the "var1" template, but how does the "var1" template actually get applied? Also what do you mean by "and the identity template"?

Thanks,

Dan

-----Original Message-----
From: Andrew Welch [mailto:andrew.j.welch@g...] 
Sent: Tuesday, July 27, 2010 2:25 PM
To: xsl-list@l...
Subject: Re: [xsl] A question of style

I'll have a guess....

Instead of concat() or:

<xsl:text>This is a </xsl:text> <xsl:value-of select="$var1"/>
<xsl:text> example</xsl:text>

with <xsl:variable name="var" select="'fill in the blanks'"/>

you could do

<xsl:variable name="content">This is a <var1> example</xsl:variable>

with <xsl:apply-templates select="$content"/>

and <xsl:template match="var1">fill in the blanks</xsl:template>  (and
the identity template)

The latter being more flexible.

cheers
andrew


On 27 July 2010 19:12, Whitney, Dan (Canwest Digital Media)
<DWhitney@c...> wrote:
>
> Dimitre,
>
> I know you said that you'd post an example, so some very, very gently prodding, I too would be very interested in an example of what you mean by "fill-in-the-blanks".
>
> Thanks,
>
> Dan
>
> -----Original Message-----
> From: Dimitre Novatchev [mailto:dnovatchev@g...]
> Sent: Thursday, July 08, 2010 12:37 AM
> To: xsl-list@l...
> Subject: Re: [xsl] A question of style
>
> On Wed, Jul 7, 2010 at 7:39 PM, Lars Huttar <lars_huttar@s...> wrote:
>> On 7/7/2010 5:54 PM, Dimitre Novatchev wrote:
>>> I definitely prefer using the concat() function than a sequence of
>>> alternating <xsl:text> and <xsl:value-of>.
>>>
>>> concat() is more or less the equivalent of prinf() in C or
>>> string.format() in C#. We don't have control characters like \n or \t,
>>> but this can easily be circumvented by using either variables (in XSLT
>>> 1.0) or character-maps in XSLT 2.0.
>>>
>>> =================
>>>
>>> *Even better*, one can use a separate "fill-in the blanks" XML
>>> document in which only specific elements need to be transformed into
>>> result values.
>>>
>>> This is a good technique which completely separates presentation from
>>> processing and allows that different "layouts" be filled-in by
>>> different transformations or the results of the same transformation be
>>> presented in different layouts.
>>>
>>> I believe this is probably one of the most important piece of
>>> knowledge that I have shared with our fellows XSLT developers in the
>>> course of many years.
>>>
>>
>> Dmitri,
>> I could only partly understand what you're describing. Have you written
>> an article on it somewhere that you could link to? with examples?
>>
>> Thanks,
>> Lars
>>
>>
>> --~------------------------------------------------------------------
>> 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@l...>
>> --~--
>>
>>
>
>
> Lars,
>
> I will find time during the next days to post a simple example.
>
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
> -------------------------------------
> Never fight an inanimate object
> -------------------------------------
> You've achieved success in your field when you don't know whether what
> you're doing is work or play
>
> --~------------------------------------------------------------------
> 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@l...>
> --~--
>
>
> --~------------------------------------------------------------------
> 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@l...>
> --~--
>
>



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
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@l...>
--~--


--~------------------------------------------------------------------
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@l...>
--~--


--~------------------------------------------------------------------
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@l...>
--~--

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.