Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSL Newbie but a really annoying problem

Reply
Thread Tools

XSL Newbie but a really annoying problem

 
 
danmat46@googlemail.com
Guest
Posts: n/a
 
      01-29-2008
Morning all,
Just started out with XSL.
Now working on my first example I have the following XML structure

<topLevel>
<repeatLevel name="hello" type="hello">
<![CDATA[sometext in here]]>
</repeatLevel>
<repeatLevel name="hello2" type="hello2">
<![CDATA[more text in here]]>
</repeatLevel>
</topLevel>

Now developing the XSL is going fine, I have an html table with three
columns and been able to output the name and type but I cannot get the
CDATA's text in the third column.

Is this possible?

And no unfortunatly I cannot change the XML format to add the CDATA as
an attribute.

Any help welcomed!

Thank you
 
Reply With Quote
 
 
 
 
Pavel Lepin
Guest
Posts: n/a
 
      01-29-2008

http://www.velocityreviews.com/forums/(E-Mail Removed) <(E-Mail Removed)> wrote in
<(E-Mail Removed)>:
> Now working on my first example I have the following XML
> structure
>
> <topLevel>
> <repeatLevel name="hello" type="hello">
> <![CDATA[sometext in here]]>
> </repeatLevel>
> <repeatLevel name="hello2" type="hello2">
> <![CDATA[more text in here]]>
> </repeatLevel>
> </topLevel>
>
> Now developing the XSL is going fine, I have an html table
> with three columns and been able to output the name and
> type but I cannot get the CDATA's text in the third
> column.
>
> Is this possible?


Yes, it is possible.

--
....also, I submit that we all must honourably commit seppuku
right now rather than serve the Dark Side by producing the
HTML 5 spec.
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-29-2008
(E-Mail Removed) wrote:
> Morning all,
> Just started out with XSL.
> Now working on my first example I have the following XML structure
>
> <topLevel>
> <repeatLevel name="hello" type="hello">
> <![CDATA[sometext in here]]>
> </repeatLevel>
> <repeatLevel name="hello2" type="hello2">
> <![CDATA[more text in here]]>
> </repeatLevel>
> </topLevel>
>
> Now developing the XSL is going fine, I have an html table with three
> columns and been able to output the name and type but I cannot get the
> CDATA's text in the third column.
>
> Is this possible?


Sure, why not? In the XSLT/XPath data model there are no CDATA sections
anyway, the repeatLevel elements simply have a string value so you can
do e.g.
<xsl:template match="repeatLevel">
<tr>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="@type"/></td>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:template>

Or with additonal templates you do e.g.

<xsl:template match="repeatLevel">
<tr>
<xsl:apply-templates select="@* | node()"/>
</tr>
</xsl:template>

<xsl:template match="repeatLevel/@* | repeatLevel/text()">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie: self.member syntax seems /really/ annoying Charles Fox Python 56 09-18-2007 11:15 PM
Really annoying wireless problem =?Utf-8?B?VHk=?= Wireless Networking 2 08-08-2006 06:39 AM
A really annoying problem Andrew Mott Computer Support 4 10-08-2005 12:39 AM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
OT : But help really really needed re: Domain Name selling, hosting etc. problem nc HTML 1 02-03-2005 07:24 PM



Advertisments