Re: xsl help needed

I believe this has to do with the default template behavior for unspecified elements.  Basically there are an internally understood template rules something to the effect:

<xsl:template match="*">
  <xsl:apply-templates/>
<xsl:template>

<xsl:template match="text()">
  <xsl:value-of select="."/>
</xsl:template>

So, what's happening is your unspecified elements are automatically recursing and then displaying their contents.  You have to specify what you want to happen with that data.
  (*Chris*)
  ----- Original Message ----- 
  From: John Cussen 
  To: www-xsl-fo@w3.org 
  Sent: Thursday, October 23, 2003 3:28 AM
  Subject: re: xsl help needed


  Hi 
    I'm trying to access xml elements using xsl and xpath but, it doesn't seem to be working.  No matter what paths I try I keep getting one line with all the elements in it as the output.  This is part of my masters thesis and if I don't solve this I can't go any further. 

  below is the xml file that I'm trying to navigate

  <?xml version="1.0" encoding="iso-8859-1"?>
  <?xml-stylesheet type="text/xsl" href="may.xsl"?>
  <Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001" xsi:schemaLocation="urn:mpeg:mpeg7:schema:2001 Mpeg7-2001.xsd">
    <Description xsi:type="ContentEntityType">
      <MultimediaContent xsi:type="VideoType">
        <Video>
          <TemporalDecomposition>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>sam</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:00:0F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">73</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:01:6036F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>yoda</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:02:17077F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">83</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:03:28118F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>two</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:05:17167F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">63</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:06:18198F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>prof</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:07:27237F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">68</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:09:270F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>great</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:10:12312F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">177</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:13:10400F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>cool</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:16:16496F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">89</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:18:540F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>ah</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:19:22592F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">14</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:19:28598F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>fighting</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:20:13613F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">23</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:20:24624F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>ship</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:21:13643F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">21</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:21:23653F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>dooku</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:22:11671F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">58</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:23:9699F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>episode2</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:24:16736F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">68</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:25:19769F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
            <VideoSegment>
              <TextAnnotation type="scene" relevance="1" confidence="1">
                <FreeTextAnnotation>end</FreeTextAnnotation>
              </TextAnnotation>
              <MediaTime>
                <MediaTimePoint>T00:00:27:1811F30000</MediaTimePoint>
                <MediaIncrDuration mediaTimeUnit="PT1001N30000F">89</MediaIncrDuration>
              </MediaTime>
              <TemporalDecomposition>
                <VideoSegment>
                  <MediaTime>
                    <MediaTimePoint>T00:00:28:15855F30000</MediaTimePoint>
                  </MediaTime>
                </VideoSegment>
              </TemporalDecomposition>
            </VideoSegment>
          </TemporalDecomposition>
        </Video>
      </MultimediaContent>
    </Description>
  </Mpeg7>


  here is the xsl document that I have tried to use on it


  <?xml version="1.0"?><!--hellot.xsl-->

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output method="html"/>

  <xsl:template match="/">
          <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="Description/MultimediaContent/Video/TemporalDecomposition">

          <html>
              <head>
                    <title>Output of query for xml document</title>
              </head>

              <body bgcolor="white">
                    <h1>Output of query for xml document</h1>

      <table border="1" cellspacing="0">
      <thead>
      <tr>
         <th>Keyword</th>
         <th>Start of clip</th>
         <th>Duration of clip</th>
         <th>End of clip</th>
      </tr>
      </thead>

      <tbody>

         <xsl:for-each select="VideoSegment/TextAnnotation[FreeTextAnnotation='yoda']">

         <tr>
          <td><xsl:value-of select="FreeTextAnnotation"/></td>

        </tr>
      </xsl:for-each>
      </tbody>
      </table>

      </body>
  </html>
  </xsl:template>

  </xsl:stylesheet>


  here is the output that I keep getting

  samT00:00:00:0F3000073T00:00:01:6036F30000yodaT00:00:02:17077F3000083T00:00:03:28118F30000twoT00:00:05:17167F3000063T00:00:06:18198F30000profT00:00:07:27237F3000068T00:00:09:270F30000greatT00:00:10:12312F30000177T00:00:13:10400F30000coolT00:00:16:16496F3000089T00:00:18:540F30000ahT00:00:19:22592F3000014T00:00:19:28598F30000fightingT00:00:20:13613F3000023T00:00:20:24624F30000shipT00:00:21:13643F3000021T00:00:21:23653F30000dookuT00:00:22:11671F3000058T00:00:23:9699F30000episode2T00:00:24:16736F3000068T00:00:25:19769F30000endT00:00:27:1811F3000089T00:00:28:15855F30000



  it has some of the elements I'm trying to get at.


  thanx 
      John








   

Received on Friday, 24 October 2003 00:03:31 UTC