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

RE: Techniques for transforming content like

Subject: RE: Techniques for transforming content like
From: "Karr, David" <David.Karr@xxxxxxxx>
Date: Thu, 24 Jul 2003 12:35:30 -0700
david karr
Ah, no.  My message got "corrupted" inadvertently, so my problem came
out somewhat unclear.  The problem is that the contents of the "value"
element is not "<userid>98765</userid>", but the same string with the
XML-significant characters escaped to their character entities.

When I view the notes in the list, I see that my original note seems to
convey that, but in your response, the part that quotes my original note
seems to have "unescaped" that piece of the XML content.

> -----Original Message-----
> From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx]
> Sent: Thursday, July 24, 2003 11:15 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Techniques for transforming content like
> 
> This stylesheet will produce the transformation you asked for.
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:output method="xml" indent="yes" encoding="UTF-8" />
>   <xsl:template match="/">
>     <xsl:apply-templates />
>   </xsl:template>
> 
>   <xsl:template match="other">
>     <other>
>       <xsl:apply-templates select="key" />
>       <xsl:apply-templates select="value" />
>     </other>
>   </xsl:template>
> 
>   <xsl:template match="key">
>     <key>
>       <xsl:value-of select="." />_<xsl:value-of
> select="name(../value/node()[position() = 1])" />
>     </key>
>   </xsl:template>
> 
>   <xsl:template match="value">
>     <value>
>       <xsl:value-of select="./userid" />
>     </value>
>   </xsl:template>
> </xsl:stylesheet>
> --
> Charles Knell
> cknell@xxxxxxxxxx - email
> 
> 
> 
> -----Original Message-----
> From:     "Karr, David" <David.Karr@xxxxxxxx>
> Sent:     Thu, 24 Jul 2003 10:26:43 -0700
> To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:   Techniques for transforming content
> like"<tag>content</tag>" to "<tag>content</tag>"
> 
> I have a requirement to write XSLT transformers for XML documents,
some
> of whose element contents can consist of "encoded" XML, like this:
> 
> <other>
>  <key>stuff</key>
>  <value><userid>98765</userid></value>
> </other>
> 
> We need to transform this to this:
> 
> <other>
>  <key>stuff_userid</key>
>  <value>98765</value>
> </other>
> 
> There's no avoiding that this will be messy, so I'm only aiming to
clean
> up the worst part of this process: how I parse the "encoded" XML.  A
POC
> for this is just using "substring-after" and "substring-before" to set
> the pieces into variables.  Is there a better way to parse content
like
> this?
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 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.