This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: create several js-functions
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] create several js-functions
- From: "Chris Bayes" <chris at bayes dot co dot uk>
- Date: Mon, 12 Nov 2001 15:17:54 -0000
- Reply-to: xsl-list at lists dot mulberrytech dot com
Nathalie,
You probably want something like
<xsl:template match="/xml/interaction">
<html>
<head>
<script>
function function1(){
<xsl:apply-templates select="*[name() != 'buttons']" />
}
function function2(){
<xsl:apply-templates select="buttons|titre" />
}
</script>
</head>
<body></body>
</html>
</xsl:template>
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of
> Nathalie Pult
> Sent: 12 November 2001 11:51
> To: xsl-list@lists.mulberrytech.com
> Subject: Re: [xsl] create several js-functions
>
>
> Hi Jeni
> > > I have to generate from one xml-file two outputs in one html-file
> > > (for javascript-functions.) In both functions, the order in which
> > > the elements are stored in the xml must be maintained. But every
> > > function needs to choose different elements. Both
> functions have to
> > > refer to the same predefined templates. How could this be done?
>
> Hi,
> here some more info:
> xml-snippet:
> <?xml version="1.0" encoding="utf-8"?>
> ...
> <interaction>
> <titre>title_1</titre>
> <texte>simple_text_1</texte>
> <exemple>
> <texte>example_text_1</texte>
> <texte>example_text_2</texte>
> </exemple>
> <texte>simple_text_2</texte>
> <exemple>
> <texte>example_text_3</texte>
> </exemple>
> <titre>title_2</titre>
> <texte>simple_text_3</texte>
> <buttons>
> <button
> value="proparoxyton">Proparoxyton</button>
> [...]
> </buttons>
> </interaction>
> </xml>
>
> Both js-funcitons are created by the same stylesheet.
> js-function1:
> should make apply all templates except the one for the
> <buttons>-Element.
> js-function2:
> should make apply only the templates for the <titre> and the
> <buttons>-Element.
>
> Since the order in which the elements are grouped in the
> xml-file is mandatory, it seems like I cannot use any
> <xsl:call-template>-construct.
>
> For every element, there is a <xsl:template
> match="...">-construct that I cannot change. Until now, I
> used to use an <xsl:template match="buttons"/> for not
> displaying any of the <buttons>-subtree. But since in one
> js-function it has to be displayed and in another not, I do
> not know how to proceed. I hope I explained the problem more
> clearly now.
>
> Thank you!
> Nathalie
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list