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

RE: Purpose of XML (was: irrelevant title)

  • From: "Michael Kay" <mike@s...>
  • To: "'Alan CANNON'" <acannon@p...>,<xml-dev@l...>
  • Date: Mon, 2 Feb 2009 21:56:43 -0000

RE:  Purpose of XML (was: irrelevant title)
First, please don't reply to an existing post when starting a new thread. Even if you change the title (which you didn't) it makes following the thread more difficult.
 
I think we've all been in this position of being told to use a particular technology for a development, and not being told why. Sometimes the reasons are good reasons, sometimes they are bad ones. It's impossible to assess whether it's a good reason in your particular case without knowing a lot more about the project requirements and environment. It might even be true that the choice is suboptimal when you take the narrow perspective of one particular development, but makes sense when viewed from a broader or longer-term perspective.
 
I think the primary Purpose of XML (nice capitalization) in data applications (as distinct from documents) is to achieve loose coupling of systems. Generally, systems that exchange data using XML are less tightly coupled than systems that communicate using other technologies. Loose coupling here means greater flexibility to change either of the systems without impacting the other, or to add new systems into the mix without impacting either.
 
To take an example of extreme tight coupling, I once came across a system where two companies exchanged data in the form of a binary image of a SQL Server database. Consequence: neither company could upgrade to a new SQL server version until the other company did the same (in fact, I think it couldn't even change the hardware platform). SQL access from one system to another is not as tightly coupled as that, but it is still constraining: it will make it difficult to change the data provider to use a different (non-SQL) technology, and it will be difficult to exploit the extracted data to serve the needs of a third application. In addition, because SQL data is tabular rather than hierarchical, it can be very difficult to introduce data structure changes such as allowing products to have multiple prices in different currencies without major impact.
 
Michael Kay
http://www.saxonica.com/


From: Alan CANNON [mailto:acannon@p...]
Sent: 02 February 2009 21:11
To: xml-dev@l...
Subject: Re: XSTL stylesheet workarounds for exceptions


im new  XML and After reading all the various posts im Extremely Confused. My Company is requesting that i export Data from the DB into xml for Data transfer services. I see alot of Different methods,Elements,Members ect... and Sub queries on Data contained within XML schema. Im in need of exporting data from MsSQL for Plant Production Declarations to our SAP systems. It looks like XML is a whole lot of work Versus just straight Transactions to the source. What is the real Purpose of XML?
Thanks for your Help
Alan Cannon
Process / Automation SCADA Engineer
Plastic Omnium
50 tyger river rd
Duncan, S.C 29344
864 622-3221 (OFFICE)
864 245-6807 (CELL)
Email: acannon@p...
Please consider your environmental responsibility before printing this e-mail



Jack Bush <netbeansfan@y...>

02/02/2009 04:03 PM

To
xml-dev@l...
cc
Subject
XSTL stylesheet workarounds for exceptions





Hi All,

I am at a stage of fine-tuning an existing stylesheet that has been worked on recently and would like include some workarounds to accommodate exceptional data in the following 2 areas:

( i ) Get the content of sub-elements <a> as follows:

<p>

  <strong>Hobbies:</strong>

  <a shape="rect" href="http://www.hobbies.com/fishing title="Shark Hunting">fishing</a>

  <a shape="rect" href="http://www.hobbies.com/hunting title="Animal">rabbit</a>

(Out-door adventures)

</p>

Intended output

<hobbies> fishing<hobbies>

<hobbies> rabbit<hobbies>

In this case, it is both fishing, rabbit that I am after. However, I still couldn’t get it working despite having tried numerous of the following stylesheet approaches:

<xsl:template match="/">

  <employee>

    <xsl:apply-templates select="//ns:p"/>

  </employee>

</xsl:template>

( A ) <xsl:template match="ns:p[ns:strong='Hobbies:']">

         <xsl:copy-of              

           <hobbies>select="ns:a"/></hobbies>

       </xsl:template>

               or

( B ) <xsl:template match="ns:p[ns:strong='Hobbies:']">

         <xsl:for-each select="ns:a/text()[normalize-space() != '']">

           <hobbies><xsl:value-of select="normalize-space()"/></hobbies>

         </xsl:for-each>

       </xsl:template>

               or

( C ) <xsl:template match="ns:p[ns:strong='Hobbies:']">

         <xsl:for-each select=".//ns:a/text()[normalize-space() != '']">

           <hobbies><xsl:value-of select="normalize-space()"/></hobbies>

         </xsl:for-each>

       </xsl:template>

              or

( D ) <xsl:template match="ns:p[ns:strong='Hobbies:']">

         <xsl:for-each select="ns:p/ns:a/text()[normalize-space() != '']">

           <hobbies><xsl:value-of select="normalize-space()"/></hobbies>

         </xsl:for-each>

       </xsl:template>

               or

( E ) <xsl:template match="ns:p[ns:strong='Hobbies:']">

         <xsl:for-each select="../ns:a//text()[normalize-space() != '']">

           <hobbies><xsl:value-of select="normalize-space()"/></hobbies>

         </xsl:for-each>

       </xsl:template>

               or

( F ) <xsl:template match="ns:p[ns:strong='Hobbies:']">

         <xsl:for-each select="ns:a">

          <xsl:for-each select="text()[normalize-space() != '']">"

            <hobbies><xsl:value-of select="normalize-space()"/></hobbies>

          </xsl:for-each>

        </xsl:for-each>

     </xsl:template>

               or

( G ) <xsl:template match="ns:p[ns:strong='Hobbies:']">

          <xsl:for-each select=".//ns:a">

            <xsl:for-each select="text()[normalize-space() != '']">"

              <hobbies><xsl:value-of select="normalize-space()"/></hobbies>

            </xsl:for-each>

          </xsl:for-each>

        </xsl:template>

( ii ) I also like to add a default generic value for any missing element. Say if there are no

<p><strong>Hobbies:</strong></p> element in such document, yet I still would like to generate a

null element such as <hobbies>Unknown</hobbies>. The intended stylesheet should look

like the following but again couldn’t get it working still:

<xsl:template match="/">

  <employee>

    <xsl:apply-templates select="//ns:p"/>

  </employee>

</xsl:template>

<xsl: choose>

  <xsl: when test="ns:p[ns:strong='Hobbies:']">

    <xsl:template match="ns:p[ns:strong='Hobbies:']">

      <xsl:for-each select="text()[normalize-space() != '']">

        <hobbies><xsl:value-of select="normalize-space()"/></hobbies>

      </xsl:for-each>

    </xsl:template>

  </xsl:when>

<xsl:otherwise>

  <hobbies>Unknown</hobbies>

</xsl:otherwise>

</xsl: choose>

I have run out of ideas and would be very much appreciated if anyone could give me some suggestion on how to tackle this task.

Jack




Stay connected to the people that matter most with a smarter inbox. http://au.rd.yahoo.com/galaxy/mail/tagline2/*http://au.docs.yahoo.com/mail/smarterinbox.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.