473,388 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Problems with mixed content type.

I have an Xml file that I am trying to transform using an Xsl
stylesheet. My data is in the form of:

<root>
...
<aaa>
<bbb>Mixed content type, with <def link="words">words</def>
defined in between pure text</bbb>
</aaa>
...
</root>

and the stylesheet I've been using looks something like:

<xsl:template match="aaa/bbb">
<xsl:apply-templates select="./*" />
</xsl:template>

<xsl:template match="def[@link]">
<xsl:element name="a">
<xsl:attribute name="href">
display.aspx?name=<xsl:value-of select="@link" />
</xsl:attribute>
<xsl:value-of select="." />
</xsl:element>
</xsl:template>

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

And what I want is to get something along the lines of:
Mixed content type, with <a
href="display.aspx?name=words">words</def> defined in between pure text

I've tried several different way, managed to get eaither the text, or
the links, or both seperatly, but not both at the same time.

A previous post mentioned using <xsl:copy-of>, but I didn't understand
how that would help. Any ideas would be greatly apreciated.

Nov 12 '05 #1
1 1261
Anas M. Nebuchadnezzar XXXVII wrote:
I have an Xml file that I am trying to transform using an Xsl
stylesheet. My data is in the form of:

<root>
...
<aaa>
<bbb>Mixed content type, with <def link="words">words</def>
defined in between pure text</bbb>
</aaa>
...
</root>

and the stylesheet I've been using looks something like:

<xsl:template match="aaa/bbb">
<xsl:apply-templates select="./*" /> Here you are applying templates only to children elements, leaving text
nodex out. Try instead <xsl:apply-templates/>
<xsl:template match="text()">
<xsl:value-of select="." />
</xsl:template>


This template could be omitted, because it duplicates built-in one.
--
Oleg Tkachenko
XmlInsider
http://blog.tkachenko.com
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Swaroop Kumar | last post by:
Hi: I'm trying to write a schema that contains information as described below: 1. The first element is a mandatory fixed string. 2. The second element is a mixed content element that can...
0
by: Fender Mussel | last post by:
Hi all, Is it possible to check the content of a mixed type? I would like to define an enumeration for it. The following example works syntactically, but XMLSpy does no checks on the content at...
32
by: jp29 | last post by:
My take on problems composing, serving and rendering XHTML documents/web pages: 1. Typical conscientious web authors are producing XHTML documents (Web pages) that feature valid Markup and with...
15
by: Bill Cohagan | last post by:
I'm trying to generate class definitions from an XSD that contains something like: <xs:complexType name="foo" mixed="true"> <xs:choice minOccurs = "0" maxOccurs="unbounded"> <xs:element name =...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
3
by: Andreas | last post by:
Hi! I'm currently developing a DLL that makes use of C++ and .net (mixed) using Visual Studio 2003. Now, as I wanted to move to the new Visual Studio 2005, I converted this project into the...
2
by: phaeton123 | last post by:
I was trying to use Xquery to try to do pattern matching over mixed structured and unstructured content. For example consider the following xml fragment: ..... <article id="777">...
1
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I have an VC++ MFC Win32 application that isn't working correctly when I build it with VS2005. The problem seems to be in some ADO ActiveX controls that came with VS6 and are now out of support....
3
by: Veli | last post by:
Good Day I have published a website and everything works expect for my forms. I can't seem to send the attachments to the email address according to the uploader. I don't know what i am doing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.