Creating a Complex System using XSLT. Step 1: Create Feedback
Hi Folks, I would like to see if collectively we can create a complex system using XSLT. Several people have been hinting at doing this. Now let's do it! I thought that a good first step in building a complex system would be to learn how to create "feedback". Let me start by defining feedback. Suppose that the "system" is a Fitness Center. Let's see how feedback may enter into a Fitness Center system: 1. New people join the Fitness Center. + +> 2. This results in increased revenue. With the new money + the Fitness Center purchases more equipment. + 3. The new equipment attracts more people to join. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This feedback loop is "amplifying" (increasing): - the number of members - the total revenue of the Fitness Center - the amount of equipment. This is called "positive feedback". Positive feedback means that big things have a tendency to get even bigger, e.g., big Fitness Centers get bigger, big newspapers get bigger, etc. The amplification will reach a steady state once the Fitness Center has as much equipment and members as it can hold, given the size of the building they are in. Thus, the size of the building imposes a "negative feedback" on the system, keeping it from expanding indefinitely. The initial stimulus which resulted in the system entering into the feedback loop was that some new people joined the Fitness Center. A small change in the system resulted in a big overall change; aka The Butterly Effect. Now let's relate this to XML and XSLT. The Fitness Center is modelled using XML: <FitnessCenter> <Members> <Member level="platinum"> <Name>Jeff</Name> <MembershipFee>$500</MembershipFee> </Member> <Member level="gold"> <Name>Stacey</Name> <MembershipFee>$350</MembershipFee> </Member> ... </Members> <TotalRevenue>$75,000</TotalRevenue> <Equipment> <Item>Cybex Leg Extension</Item> <Item>Hammer Strength Lat Row</Item> ... </Equipment> </FitnessCenter> How can we design our XSLT stylesheet to exhibit feedback? One thought might be to create a stylesheet which "simulates" the growth of the Fitness Center: FitnessCenter.xml --> FitnessCenter.xsl --> newFitnessCenter.xml Parameter: New Members List The stylesheet inputs the FitnessCenter XML document along with a stylesheet parameter that contains a list of new members. The stylesheet then simulates the feedback loop by generating new <Equipment> items, which then results in creating new <Member> elements, which results in generating new <Equipment> items, which then results in creating new <Member> elements, etc. The output XML document shows an updated Fitness Center with more members, a larger total revenue, and more equipment. However, I don't feel that such a "simulation stylesheet" would be a good example of feedback for this reason: - XSLT is not really a simulation language. If the purpose is to run a simulation then it would probably be better to use a language explicitly designed for simulations. So how can we write a stylesheet which exhibits feedback and takes advantage of what XSLT is good at - processing XML documents? Answer: I don't know. I am hoping that collectively we can arrive at a good example. Here are some thoughts: the above example shows the feedback loop amplifying the member count, the total revenue, and the equipment count. Perhaps that's the wrong thing to focus upon. That is focusing upon the Fitness Center. Perhaps instead the focus should be on the stylesheet itself. Perhaps some aspect of the stylesheet should get amplified, e.g., perhaps the output of the stylesheet is another sylesheet which is "amplified" with more template rules. I don't know. I have run into a wall. I am hoping that someone can help me to be break through the wall and see the light. /Roger
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format