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

RE: RE: Transformation XML to XML

Subject: RE: RE: Transformation XML to XML
From: "Rob Merrison" <rob.merrison@xxxxxxxxxxxx>
Date: Tue, 19 Jul 2005 16:21:23 +0100
bdc6e3f0 6da3 11d1 a2a3 00aa00c14882
That did not work as expected

<image1 xmlns:s="uuid:bdc6e3f0-6da3-11d1-a2a3-00aa00c14882"
xmlns:z="#rowsetschema"><pdesc>hot
rod</pdesc><filename>ab_0001.jpg</filename><photoid>223</photoid><photogid>5
</photogid></image1>

I tried modifying what you had sent to this

<xsl:template match="/">
  <collection>
    <xsl:apply-templates select="//z:row"/>
  </collection>
</xsl:template>

<xsl:template match="z:row">
  <image>
    <xsl:for-each select="@*">
      <xsl:copy-of select="."/>
    </xsl:for-each>
  </image>
</xsl:template>

<collection xmlns:s="uuid:bdc6e3f0-6da3-11d1-a2a3-00aa00c14882"
xmlns:z="#rowsetschema"><image pdesc="hot rod" filename="ab_0001.jpg"
photoid="223" photogid="5"></image><image pdesc="brass headlamps"
filename="ab_0002.jpg" photoid="224" photogid="5"></image></collection>

Which seems to provide what I actually need, so thanks for your pointer,
much appreciated?

By the way, do I need to get rid of the
xmlns:s="uuid:bdc6e3f0-6da3-11d1-a2a3-00aa00c14882 in the <collection tag?

Also, I found that the tag <image> puts image place holders all over the
page, so changed that to <images>

Many Thanks, Rob.

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: 19 July 2005 15:47
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  RE: Transformation XML to XML

This is just horrible. disable-output-escaping should never be used to
construct markup in the serialized output. And in this case, there's no
possible excuse because the correct code is dead easy:

><xsl:template match="z:row">  
><xsl:text disable-output-escaping="no">&lt;image&gt;</xsl:text>
><xsl:for-each select="@*">
   <xsl:text disable-output-escaping="no">&lt;</xsl:text>
   <xsl:value-of select="name()"/>
   <xsl:text disable-output-escaping="no">&gt;</xsl:text>
>  <xsl:value-of select="."/>
>  <xsl:text disable-output-escaping="no">&lt;/</xsl:text>
>  <xsl:value-of select="name()"/>
>  <xsl:text disable-output-escaping="no">&gt;</xsl:text>
></xsl:for-each>
><xsl:text disable-output-escaping="no">&lt;/image&gt;</xsl:text>
></xsl:template>

What's wrong with:

<xsl:template match="z:row">
<image>
  <xsl:for-each select="@*">
    <xsl:element name="{name()}">
      <xsl:value-of select="."/>
    </xsl:element>
  </xsl:for-each>
</image>
</xsl:template>

Michael Kay
http://www.saxonica.com/

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.