xsl variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sb1

    #1

    xsl variables

    Hi

    I am new to xml and I am trying to use xsl to transform my xml
    document to smil.

    I want to create a line such as
    <video src="../media/countries_video/cuba_100.ram "
    id="../media/countries_video/greece_100.ram " region="x"/>

    for a number of different video files, the references to which are
    held within my xml files. At the minute my code:

    <xsl:for-each select="$destin ation/Country/CountryVideo">

    <xsl:variable name="countryvi d"
    select="$destin ation/Country/CountryVideo"/>
    <video src="{$countryv id}" id="{$countryvi d}" region="x" />
    </xsl:for-each>

    produces the correct number of lines but each contains the reference
    to the same file, I'm guessing this is because I can't use the one
    variable to reference each. I'd appreciate it if anyone could give me
    some pointers on how to get around this. (Bearing in mind I'm very new
    to all this!)
    Thanks in advance
  • Martin Honnen

    #2
    Re: xsl variables

    sb1 wrote:
    [color=blue]
    > Hi
    >
    > I am new to xml and I am trying to use xsl to transform my xml
    > document to smil.
    >
    > I want to create a line such as
    > <video src="../media/countries_video/cuba_100.ram "
    > id="../media/countries_video/greece_100.ram " region="x"/>
    >
    > for a number of different video files, the references to which are
    > held within my xml files. At the minute my code:
    >
    > <xsl:for-each select="$destin ation/Country/CountryVideo">
    >
    > <xsl:variable name="countryvi d"
    > select="$destin ation/Country/CountryVideo"/>[/color]

    Try
    <xsl:variable name="countryvi d" select="." />
    as the for-each has already selected the right element.
    [color=blue]
    > <video src="{$countryv id}" id="{$countryvi d}" region="x" />
    > </xsl:for-each>
    >
    > produces the correct number of lines but each contains the reference
    > to the same file, I'm guessing this is because I can't use the one
    > variable to reference each. I'd appreciate it if anyone could give me
    > some pointers on how to get around this. (Bearing in mind I'm very new
    > to all this!)
    > Thanks in advance[/color]


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • sb1

      #3
      Re: xsl variables

      Thanks

      Martin Honnen <mahotrash@yaho o.de> wrote in message news:<409b82bb$ 0$26346$9b4e6d9 3@newsread4.arc or-online.net>...[color=blue]
      > sb1 wrote:
      >[color=green]
      > > Hi
      > >
      > > I am new to xml and I am trying to use xsl to transform my xml
      > > document to smil.
      > >
      > > I want to create a line such as
      > > <video src="../media/countries_video/cuba_100.ram "
      > > id="../media/countries_video/greece_100.ram " region="x"/>
      > >
      > > for a number of different video files, the references to which are
      > > held within my xml files. At the minute my code:
      > >
      > > <xsl:for-each select="$destin ation/Country/CountryVideo">
      > >
      > > <xsl:variable name="countryvi d"
      > > select="$destin ation/Country/CountryVideo"/>[/color]
      >
      > Try
      > <xsl:variable name="countryvi d" select="." />
      > as the for-each has already selected the right element.
      >[color=green]
      > > <video src="{$countryv id}" id="{$countryvi d}" region="x" />
      > > </xsl:for-each>
      > >
      > > produces the correct number of lines but each contains the reference
      > > to the same file, I'm guessing this is because I can't use the one
      > > variable to reference each. I'd appreciate it if anyone could give me
      > > some pointers on how to get around this. (Bearing in mind I'm very new
      > > to all this!)
      > > Thanks in advance[/color][/color]

      Comment

      Working...