[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl and xml CDATA or Not question

Subject: Re: xsl and xml CDATA or Not question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 12 Mar 2004 17:08:37 GMT
xml cdata file

  Thanks for your reply. I searched the faq but didn't find what I was looking
  for, but I could have not searched correctly.

Not necessarily:-) my definition of faq was a question that gets
frequently asked (most weeks, i would guess) I just assume these things
automatically end up in DaveP's pages somewehere...

  And got this
  xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" inserted into
  a lot of the code. 
  Is there a way to get rid of that. Plus, my other question is now.

Easiest way is not to put it in the source, so it wont be copied
(W3C Schema should never have defined these xsl namespaced attrbutes
which then polute every other document type)
othewise, you don't want a copy so instead of
<xsl:copy-of select="node()"/>
you want xsl:apply-templates/> together with a template something like
<xsl:template match="*">
 <xsl:element name="local-name()">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>

here, <xsl:element name="local-name()"> will produce an element with
same name as in the source file but as it is generated, rather than
copied, it won't pick up stray namespaces.

  What do I need to do to make changes to certain tags like the img tag in the
  Content html?

XSLT has no access to the tags in your source file, only to elements
nodes in the tree, which isn't quite the same thing,

<xsl:template match="img">
[img: <xsl:value-of select="@alt|@ALT"]
</xsl:template>

  I know its something like this but im missing something cause this doesn't
  work.

Th eone you have would work (but it neednt be that complicated) if it
doesn't then presumably you are not applying templates to img elements
so that template isn't firing (ie, something is wrong somewhere else in
your stylesheet)

In particular if you are using namespaces, and your html-ish elements
are in the xhtml namespace match="img" won't work as that maches img in
no namespace.

david

-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.