Results 1 to 4 of 4

Thread: XSLT & copy-of/value-of: problem

  1. #1

    Thread Starter
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

    Unhappy XSLT & copy-of/value-of: problem

    I have a XML fragment that looks like this:
    Code:
    ...
    <paragraph heading="Introduction">
    Before you begin you should know:
    -thing 1<br/>
    -thing 2<br/>
    -thing 3<br/>
    </paragraph>
    ...
    Now from within an XSLT I'd like to grab the contents of the paragraph __including__ the <br/> tags. When I try:

    Code:
    <xsl:for-each select=".">
    <p><xsl:value of select="."/></p>
    </xsl:for-each>
    I lose the <br/> tags. When I tried replacing the <value-of> with <copy-of> I get the whole text between (and including) the <paragraph> tags.

    How do I just the contents? I've taken a look at the different axes but those don't seem to help. As a last resort I wrap the <br> around the text but that doesn't seem to be too elegant a solution.
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: XSLT & copy-of/value-of: problem

    The <br> tag is stupid anyway. The <l> tag of XHTML 2 is indeed wrapped around the text. In your situation, the appropriate tag would be <ul> anyway.
    You can also try
    <xsl:copy-of select=".//"/>
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

    Re: XSLT & copy-of/value-of: problem

    <l> ? cool, did you read an interesting article on the new tags somewhere that you could quickly paste a link to? (crawling through standards drafts is no fun)
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: XSLT & copy-of/value-of: problem

    No, no article. Just crawling through the drafts.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width