XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
XML documents get richer and richer the more XSLT rules thatprocess it

Olivier Rossel wrote:

> rules can add data to the working memory, and these data will
> trigger other rules that add other data to the working memory, 
> and so on.

Fascinating!

I decided to create an example to illustrate this. Would someone be willing to create an XSLT implementation?

This is the input document to an XSLT program:

<Gun>
     <serial>ABCD</serial>
</Gun>

The XSLT program contains a rule for the Gun serial element. The rule fires. The rule maps serial numbers to person names. Thus, the rule adds person information to the XML document. After the rule finishes, this is the XML document:

<GunLicense>
    <registeredGun>
         <Gun>
              <serial>ABCD</serial>
         </Gun>
    </registeredGun>
    <holder>
         <Person>
              <name>Fred Blogs</name>
         </Person>
    </holder>
</GunLicense>

The XSLT program contains a rule for the Person name element. The rule fires. The rule maps names to drivers license numbers. The rule adds drivers license information to the XML document. After the rule finishes, this is the XML document: 

<GunLicense>
    <registeredGun>
         <Gun>
              <serial>ABCD</serial>
         </Gun>
    </registeredGun>
    <holder>
         <Person>
              <name>Fred Blogs</name>
              <driversLicenseNumber>ZXYZXY</driversLicenseNumber>
         </Person>
    </holder>
</GunLicense>

The XSLT program contains a rule for the driversLicenseNumber element. The rule has information about a speeder that the police just pulled over, and a recent robbery where the robber dropped the gun. The driver's license and Gun serial number match the values in the XML document. The rule knows that only one gun can have any given serial number, and only one person can have any given driver's license number, so the rule outputs this as the result XML document:

<Alert>
   The speeder is the person who committed the recent robbery!
</Alert>

Recap: the initial XML input into the XSLT program is small. A rule for the Gun serial element fires and adds Person data to the XML input document. This causes a rule for the Person name element to fire, which adds driver's license data to the XML input document. This causes a rule for driver's license element to fire, which recognizes that the speeder is the robber; the rule outputs an XML document that alerts the police about the person he has pulled over.

The XSLT rules add data to the XML input document! The XML document gets richer and richer the more rules that process it!

Would someone be willing to write an XSLT program that implements this? 

Thanks Olivier!

/Roger



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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS