Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2007, 08:10 AM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default mixed content parsing

Hi all,
I have the following XML file that needs to be transformed to a html document. It represents an exam for some course. The problem is that I don't know how to go about transforming mixed content that is used in a 'fill in exercise'.

xml:
<missing_words_q>
Een <blank>validator</blank> is een component die je kan gebruiken om
te controleren of een xml document correct is. Een <blank>well-formed</blank> document voldoet aan alle regels van xml, terwijl een <blank>valid</blank> document ook voldoet aan de regels van een bijhorende DTD.
</missing_words_q>

The desired output:
<p>Een <input type="text" name="validator" /> is een component die je kan gebruiken om te controleren of een xml document correct is.
...
</p>
... The same rules apply for each <blank>

I've searched for mixed content tutorials on different websites but I'm not at all known with XPath and the things I see there are hard for me to understand.
 
Old October 7th, 2007, 10:29 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This is done with bog-standard use of XSLT template rules:

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

<xsl:template match="blank">
<input type="text" name="{.}"/>
</xsl:template>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old October 7th, 2007, 04:54 PM
Registered User
 
Join Date: Mar 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your fast reply. I understand a lot more about xslt thanks to your post. Everything works fine.
greetings






Similar Threads
Thread Thread Starter Forum Replies Last Post
Java solution Read Mixed data columns from excel. pranjaldutta VBScript 1 March 19th, 2007 12:29 PM
Choosing content depending on content of other ele dsekar_nat XSLT 1 February 27th, 2006 05:58 AM
Parsing mwviola98 SQL Language 4 July 21st, 2005 10:35 AM
Mixed Mode and Stored Credentials jmurdock BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 June 25th, 2004 10:26 AM
mixed mode authentication Tremmorkeep SQL Server 2000 6 June 21st, 2004 12:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.