Re: novice Q: can an element have text and subelements at the same time?

Discussion in 'XML' started by Nicole Szymanski, Jul 10, 2003.

  1. > <title>aaa</title>
    > <access>
    > Click bbb to achieve aaa.
    > </access>
    >
    > how do I make 'bbb' and 'aaa' bold with XSL? is it at all possible
    > without introducing new children of the 'access' tag?


    I think that the best XML like solution would be to do something
    similar to :

    <element>
    <operation>aaaa</operation>
    <link>bbbb</link>
    </element>

    And then use a template like :

    <xsl:template match="element">
    <h3><xsl:value-of select="operation" /></h3>

    Click <b><xsl:value-of select="link" /></b>
    to achieve <b><xsl:value-of select="operation" /></b>.
    </xsl:template>


    > is it possible to pick up value of 'title' tag and put it inside
    > 'access'?
    > (aaa stays the same as in the 'title' so in the body of 'access')...


    You can try to get the title element of the parent, something like

    <xsl:value-of select="../title" />


    --
    Nicole
    Nicole Szymanski, Jul 10, 2003
    #1
    1. Advertising

  2. Nicole Szymanski

    AS Guest

    Nicole, thanks for replying,

    > I think that the best XML like solution would be to do something
    > similar to :
    >
    > <element>
    > <operation>aaaa</operation>
    > <link>bbbb</link>
    > </element>
    >
    > And then use a template like :
    >
    > <xsl:template match="element">
    > <h3><xsl:value-of select="operation" /></h3>
    >
    > Click <b><xsl:value-of select="link" /></b>
    > to achieve <b><xsl:value-of select="operation" /></b>.
    > </xsl:template>
    >


    the problem is also that 'click' and 'to achieve' do change from one help
    page to another.

    so the following might work, but it is ugly, right?
    ---
    <element>
    <firstPartOf Sentence>Click</firstPartOf Sentence>
    <operation>aaaa</operation>
    <secondPartOf Sentence>to achieve</secondPartOf Sentence>
    <link>bbbb</link>
    </element>
    ---

    and all this headache only to make 2 words bold...
    thanks!
    AS, Jul 10, 2003
    #2
    1. Advertising

  3. Nicole Szymanski

    AS Guest

    Nicole,

    that was actually my problem - can an element contain text AND subelements
    (children) at the same time?

    > <helppage>
    > <topic>aaaa</topic>
    > <message>
    > Please click on <b>bbbb</a> to <print_topic />.
    > </message>
    > </helppage>


    here <message> contains text + elements <a> and <print_topic />

    my schema file complains...
    is there a way to put text and elements inside of an element in the schema?

    thanks a lot for your help,

    A.

    >
    > And a template file the converts that to
    >
    > <xsl:template match="helppage">
    > <h3><xsl:value-of select="topic" /></h3>
    > <xsl:value-of select="message" />
    > </xsl:template>
    >
    > <xsl:template match="helppage/print_topic">
    > <xsl:value-of select="../topic" />
    > </xsl:template>
    >
    > Regards,
    > --
    > Nicole
    AS, Jul 11, 2003
    #3
  4. Nicole Szymanski

    AS Guest

    Ok, I am reading about 'mixed content' now. that should fix my problem.
    thanks!

    "AS" <> wrote in message
    news:bemo7g$m33$...
    > Nicole,
    >
    > that was actually my problem - can an element contain text AND subelements
    > (children) at the same time?
    >
    > > <helppage>
    > > <topic>aaaa</topic>
    > > <message>
    > > Please click on <b>bbbb</a> to <print_topic />.
    > > </message>
    > > </helppage>

    >
    > here <message> contains text + elements <a> and <print_topic />
    >
    > my schema file complains...
    > is there a way to put text and elements inside of an element in the

    schema?
    >
    > thanks a lot for your help,
    >
    > A.
    >
    > >
    > > And a template file the converts that to
    > >
    > > <xsl:template match="helppage">
    > > <h3><xsl:value-of select="topic" /></h3>
    > > <xsl:value-of select="message" />
    > > </xsl:template>
    > >
    > > <xsl:template match="helppage/print_topic">
    > > <xsl:value-of select="../topic" />
    > > </xsl:template>
    > >
    > > Regards,
    > > --
    > > Nicole

    >
    >
    AS, Jul 11, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nitin Khurana
    Replies:
    2
    Views:
    816
    Jonathan Bromley
    Apr 27, 2004
  2. Daniel Jorge

    SubElements in my WebControl

    Daniel Jorge, Jul 10, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    337
    Daniel Jorge
    Jul 10, 2005
  3. thomas
    Replies:
    2
    Views:
    379
    thomas
    Jan 25, 2004
  4. David Simons

    print all subelements plus content

    David Simons, Feb 23, 2005, in forum: XML
    Replies:
    0
    Views:
    367
    David Simons
    Feb 23, 2005
  5. HANM
    Replies:
    2
    Views:
    683
    Joseph Kesselman
    Jan 29, 2008
Loading...

Share This Page