|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
XML Help Needed
Say I have a simple XML file including this:
Code:
<ProductInfo>The <item>shirt</item> comes in 3 sizes.</ProductInfo> <Comments>One <item>shirt</item> costs £10</Comments> I need the XML file to know that the two instances of "shirt" are the same, so something like this: Code:
<ProductInfo>The <item id="S3"/> comes in 3 sizes.</ProductInfo> <Comments>One <item id="S3"/> costs £10</Comments> <item id="S3" name="shirt"/> ...something to that effect, but obviously I'm doing it the wrong way. What I want to achieve is a document that will look like this: The shirt comes in 3 sizes. One shirt costs £10 ...so if I change "shirt" to "t-shirt" it will change in both places. I'm finding it quite difficult to explain, but I hope you understand and can help me. Thanks. |
|
#2
|
|||
|
|||
|
What are planning to use to generate the resulting document? Because on it's own XML is just a tag language and there are many applications/ways of transforming XML into something viewable.
Also, typically one would not mix data with pseudo-formatted output in the same document. Usuallly you have things broken into data and view transforms. For example, if you use XML with XSL, you might have the following documents. Your XML document would have the data: <item type="shirt" cost="10" numsizes="3"/> And your XSL document would define how to output that into say HTML. Here's an XSL fragment: <xsl:template match="item"> <p>The <xsl:value-of select="@type"/> comes in <xsl:value-of select="@numsizes"/> sizes.</p> </xsl:template> So the key is how do you plan to view your XML?
__________________
Robert Dominy About Guide for JavaScript http://javascript.about.com Software Consulting & Development http://www.angusog.com |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XML Help Needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|