Multiple Elements

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael.Ruehling@t-online.de

    Multiple Elements

    Hi,
    I've got another question.
    My Code works fine now and I've tried some other functions.
    XSLT-Code is now:


    <!DOCTYPE BUCH [
    <!ELEMENT BUCH (KAPITEL)+>
    <!ELEMENT KAPITEL (UEBERSCHRIFT*, ZWISCHENUEBERSC HRIFT*,
    TEXT*)>
    <!ELEMENT UEBERSCHRIFT (#PCDATA)>
    <!ELEMENT ZWISCHENUEBERSC HRIFT (#PCDATA)>
    <!ELEMENT TEXT (#PCDATA)>
    ] >

    Like on the Book the MULTIPLE says "Allow Multiple Tags of this".
    But IE6 &NE7 &MOZ doesn't show Multiple Lines. They only show ONE
    Sub-Tag (the Content) per KAPITEL. They do show multiple KAPITEL.
    Does anyone know why?


    M.

  • Joe Fawcett

    #2
    Re: Multiple Elements



    <Michael.Ruehli ng@t-online.dewrote in message
    news:ttl444t8ld 40q1qum93gl2svl 9amro1sc9@4ax.c om...
    Hi,
    I've got another question.
    My Code works fine now and I've tried some other functions.
    XSLT-Code is now:
    >
    >
    <!DOCTYPE BUCH [
    <!ELEMENT BUCH (KAPITEL)+>
    <!ELEMENT KAPITEL (UEBERSCHRIFT*, ZWISCHENUEBERSC HRIFT*,
    TEXT*)>
    <!ELEMENT UEBERSCHRIFT (#PCDATA)>
    <!ELEMENT ZWISCHENUEBERSC HRIFT (#PCDATA)>
    <!ELEMENT TEXT (#PCDATA)>
    ] >
    >
    Like on the Book the MULTIPLE says "Allow Multiple Tags of this".
    But IE6 &NE7 &MOZ doesn't show Multiple Lines. They only show ONE
    Sub-Tag (the Content) per KAPITEL. They do show multiple KAPITEL.
    Does anyone know why?
    >
    >
    M.
    >
    If the DOCTYPE is for BUCH you can only have one BUCH element otherwise the
    XML would not be a well-formed document, it would be a fragment. The +
    applies to the KAPITEL elements.

    --

    Joe Fawcett


    Comment

    • David Carlisle

      #3
      Re: Multiple Elements

      Michael.Ruehlin g@t-online.de wrote:
      Hi,
      I've got another question.
      My Code works fine now and I've tried some other functions.
      XSLT-Code is now:
      >
      >
      <!DOCTYPE BUCH [
      That's the dtd not the XSLT, but I assume the xslt is similar to the
      code posted in the earlier thread.

      <H3>
      <xsl:value-of select="ZWISCHE NUEBERSCHRIFT"/>
      </H3>


      the select="ZWISCHE NUEBERSCHRIFT" does select all those elements but
      value-of (in xslt 1) just gives the string value of the first.

      When rendering a document structure to html as here normally you dont
      want to use for-each and value-of at all, but rather apply-templates, so
      that the output structure mirrors the input structure.

      so you don't need a template matching BUCH as you want the default
      processing there


      but you do want something like

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


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


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

      David
      --

      Comment

      • Michael.Ruehling@t-online.de

        #4
        Re: Multiple Elements

        Hi,
        I am sorry for not beeing totally precise.
        The BUCH or KAPITEL function works fine. What
        makes the problem ist the UEBERSCHRIFT-thing.

        XSLT-Code says UEBERSCHRIFT can be more than one
        (the reference part of my book says so). And I want
        to have more than one UEBERSCHRIFT in one KAPITEL.
        Even more than one ZWISCHENUEBERSC HRIFT and TEXT.
        I don't want to have only one UEBERSCHRIFT and ZWISCHENUEBERSC HRIFT
        and TEXT Part in my KAPITEL, because, it makes no sense
        to have an extra KAPITEL for a short TEXT which belongs to a
        UEBERSCHRIFT.

        M.


        On Sun, 01 Jun 2008 10:55:04 +0100, David Carlisle
        <david-news@dcarlisle. demon.co.ukwrot e:
        >Michael.Ruehli ng@t-online.de wrote:
        >Hi,
        >I've got another question.
        >My Code works fine now and I've tried some other functions.
        >XSLT-Code is now:
        >>
        >>
        ><!DOCTYPE BUCH [
        >
        >That's the dtd not the XSLT, but I assume the xslt is similar to the
        >code posted in the earlier thread.
        >
        <H3>
        <xsl:value-of select="ZWISCHE NUEBERSCHRIFT"/>
        </H3>
        >
        >
        >the select="ZWISCHE NUEBERSCHRIFT" does select all those elements but
        >value-of (in xslt 1) just gives the string value of the first.
        >
        >When rendering a document structure to html as here normally you dont
        >want to use for-each and value-of at all, but rather apply-templates, so
        >that the output structure mirrors the input structure.
        >
        >so you don't need a template matching BUCH as you want the default
        >processing there
        >
        >
        >but you do want something like
        >
        ><xsl:templat e match="UEBERSCH RIFT">
        <h1>
        <xsl:apply-templates/>
        <h1>
        ></xsl:template>
        >
        >
        ><xsl:templat e match="ZWISCHEN UEBERSCHRIFT">
        <h3>
        <xsl:apply-templates/>
        <h3>
        ></xsl:template>
        >
        >
        ><xsl:templat e match="TEXT">
        <p>
        <xsl:apply-templates/>
        <p>
        ></xsl:template>
        >
        >David

        Comment

        • Peter Flynn

          #5
          Re: Multiple Elements

          Michael.Ruehlin g@t-online.de wrote:
          Hi,
          I am sorry for not beeing totally precise.
          The BUCH or KAPITEL function works fine. What
          makes the problem ist the UEBERSCHRIFT-thing.
          >
          XSLT-Code says UEBERSCHRIFT can be more than one
          (the reference part of my book says so). And I want
          to have more than one UEBERSCHRIFT in one KAPITEL.
          Even more than one ZWISCHENUEBERSC HRIFT and TEXT.
          I don't want to have only one UEBERSCHRIFT and ZWISCHENUEBERSC HRIFT
          and TEXT Part in my KAPITEL, because, it makes no sense
          to have an extra KAPITEL for a short TEXT which belongs to a
          UEBERSCHRIFT.
          Yes, it is possible (but unusual) to have more than one ueberschrift
          in a chapter.

          I think you may be confusing the ueberschrift with the concept of a
          container like <sectionor <subsection>. XML is normally built on a
          hierarchical model or containers, unlike (eg) LaTeX, where headings
          are simply interruptions to the flow of text (eg \section{}, not
          \begin{section} ...\end{section }).

          <!DOCTYPE buch [
          <!ELEMENT buch (kapitel)+>
          <!ELEMENT kapitel (ueberschrift,t ext+,unterkapit el*)>
          <!ELEMENT ueberschrift (#PCDATA)>
          <!ELEMENT unterkapitel (ueberschrift,t ext+)>
          <!ELEMENT text (#PCDATA)>
          ]>
          <buch>
          <kapitel>
          <ueberschrift ></ueberschrift>
          <text></text>
          <text></text>
          <text></text>
          <unterkapitel >
          <ueberschrift ></ueberschrift>
          <text></text>
          <text></text>
          <text></text>
          </unterkapitel>
          <unterkapitel >
          <ueberschrift ></ueberschrift>
          <text></text>
          <text></text>
          <text></text>
          </unterkapitel>
          <unterkapitel >
          <ueberschrift ></ueberschrift>
          <text></text>
          <text></text>
          <text></text>
          </unterkapitel>
          </kapitel>
          <kapitel>
          <ueberschrift ></ueberschrift>
          <text></text>
          </kapitel>
          </buch>

          ///Peter

          Comment

          • =?UTF-8?B?TWljaGFlbCBSw7xobGluZw==?=

            #6
            Re: Multiple Elements

            Hi,
            this seems to be the right way, I suppose and therefore
            I will try this as soons as possible. And furthermore if
            this works for me, I will try to understand it.


            thanx
            M.

            Peter Flynn schrieb:
            Michael.Ruehlin g@t-online.de wrote:
            >Hi,
            >I am sorry for not beeing totally precise.
            >The BUCH or KAPITEL function works fine. What
            >makes the problem ist the UEBERSCHRIFT-thing.
            >>
            >XSLT-Code says UEBERSCHRIFT can be more than one
            >(the reference part of my book says so). And I want
            >to have more than one UEBERSCHRIFT in one KAPITEL.
            >Even more than one ZWISCHENUEBERSC HRIFT and TEXT.
            >I don't want to have only one UEBERSCHRIFT and ZWISCHENUEBERSC HRIFT
            >and TEXT Part in my KAPITEL, because, it makes no sense
            >to have an extra KAPITEL for a short TEXT which belongs to a
            >UEBERSCHRIFT .
            >
            Yes, it is possible (but unusual) to have more than one ueberschrift
            in a chapter.
            >
            I think you may be confusing the ueberschrift with the concept of a
            container like <sectionor <subsection>. XML is normally built on a
            hierarchical model or containers, unlike (eg) LaTeX, where headings
            are simply interruptions to the flow of text (eg \section{}, not
            \begin{section} ...\end{section }).
            >
            <!DOCTYPE buch [
            <!ELEMENT buch (kapitel)+>
            <!ELEMENT kapitel (ueberschrift,t ext+,unterkapit el*)>
            <!ELEMENT ueberschrift (#PCDATA)>
            <!ELEMENT unterkapitel (ueberschrift,t ext+)>
            <!ELEMENT text (#PCDATA)>
            ]>
            <buch>
            <kapitel>
            <ueberschrift ></ueberschrift>
            <text></text>
            <text></text>
            <text></text>
            <unterkapitel >
            <ueberschrift ></ueberschrift>
            <text></text>
            <text></text>
            <text></text>
            </unterkapitel>
            <unterkapitel >
            <ueberschrift ></ueberschrift>
            <text></text>
            <text></text>
            <text></text>
            </unterkapitel>
            <unterkapitel >
            <ueberschrift ></ueberschrift>
            <text></text>
            <text></text>
            <text></text>
            </unterkapitel>
            </kapitel>
            <kapitel>
            <ueberschrift ></ueberschrift>
            <text></text>
            </kapitel>
            </buch>
            >
            ///Peter

            Comment

            • =?UTF-8?B?TWljaGFlbCBSw7xobGluZw==?=

              #7
              Re: Multiple Elements

              Hi,
              sorry but this doesn't work for me. But with a little
              brainstorming this code works for me (together with the
              XSLT-Code):
              <?xml version="1.0" encoding="UTF-8"?>
              <?xml-stylesheet href="test10.xs l" type="text/xsl"?>
              <!DOCTYPE BUCH [<!ELEMENT BUCH (KAPITEL)+>
              <!ELEMENT KAPITEL (UEBERSCHRIFT, UNTERKAPITEL*)* >
              <!ELEMENT UEBERSCHRIFT (#PCDATA)>
              <!ELEMENT UNTERKAPITEL (ZWISCHENUEBERS CHRIFT,POINT,TE XT)*>
              <!ELEMENT POINT (#PCDATA)>
              <!ELEMENT ZWISCHENUEBERSC HRIFT (#PCDATA)>
              <!ELEMENT TEXT (#PCDATA)>] >

              XSLT-Code:
              <?xml version="1.0" encoding="UTF-8"?>
              <xsl:styleshe et version="1.0"
              xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
              <xsl:output method="html"></xsl:output>
              <xsl:template match="BUCH">
              <xsl:for-each select="KAPITEL ">
              <H1>
              <xsl:value-of select="UEBERSC HRIFT"></xsl:value-of>
              </H1>
              <xsl:for-each select="UNTERKA PITEL">
              <H3>
              <xsl:value-of select="ZWISCHE NUEBERSCHRIFT"> </xsl:value-of>
              </H3>
              <H4>
              <xsl:value-of select="POINT"> </xsl:value-of>
              </H4>
              <P>
              <xsl:value-of select="TEXT"></xsl:value-of>
              </P>
              </xsl:for-each>
              </xsl:for-each>
              </xsl:template>
              </xsl:stylesheet>

              thanx for alle the hints

              M.
              Michael Rühling schrieb:
              Hi,
              this seems to be the right way, I suppose and therefore
              I will try this as soons as possible. And furthermore if
              this works for me, I will try to understand it.
              >
              >
              thanx
              M.
              >
              Peter Flynn schrieb:
              >Michael.Ruehlin g@t-online.de wrote:
              >>Hi,
              >>I am sorry for not beeing totally precise.
              >>The BUCH or KAPITEL function works fine. What makes the problem ist
              >>the UEBERSCHRIFT-thing.
              >>>
              >>XSLT-Code says UEBERSCHRIFT can be more than one (the reference part
              >>of my book says so). And I want to have more than one UEBERSCHRIFT in
              >>one KAPITEL. Even more than one ZWISCHENUEBERSC HRIFT and TEXT.
              >>I don't want to have only one UEBERSCHRIFT and ZWISCHENUEBERSC HRIFT
              >>and TEXT Part in my KAPITEL, because, it makes no sense to have an
              >>extra KAPITEL for a short TEXT which belongs to a UEBERSCHRIFT.
              >>
              >Yes, it is possible (but unusual) to have more than one ueberschrift
              >in a chapter.
              >>
              >I think you may be confusing the ueberschrift with the concept of a
              >container like <sectionor <subsection>. XML is normally built on a
              >hierarchical model or containers, unlike (eg) LaTeX, where headings
              >are simply interruptions to the flow of text (eg \section{}, not
              >\begin{section }...\end{sectio n}).
              >>
              ><!DOCTYPE buch [
              ><!ELEMENT buch (kapitel)+>
              ><!ELEMENT kapitel (ueberschrift,t ext+,unterkapit el*)>
              ><!ELEMENT ueberschrift (#PCDATA)>
              ><!ELEMENT unterkapitel (ueberschrift,t ext+)>
              ><!ELEMENT text (#PCDATA)>
              >]>

              Comment

              Working...