XML-Controlling text via attribute name- then import into separate fields (depending on attribute)
Hopefully more or less my last question for now regarding XML!
Looking closer at my XML file, to make sure I'm accounting for all instances of required data when importing into Filemaker I've seen that in a couple of instances I have an element name which contains an attribute, and depending on what the attribute is I should really treat these differently. The two in question are:
A. <CompanyName Class="Company"> or <CompanyName Class="Petitioner">
Currently I have within my XSLT to account for CompanyName:
<COL><DATA><xsl:for-each select="Company/CompanyName"><xsl:value-of select="." /><xsl:text> </xsl:text></xsl:for-each></DATA></COL>
This picks up the contents of <CompanyName> whilst inside of <Company> tag, and on import into Filemaker finds a field on each record named "CompanyName". It seem that I should now look to elaborate on this, as so:
If <CompanyName Class="Company"> and it appears inside of <Company> tag I require it to find its way on import into Filemaker into a field called CompanyName. If on the other hand I come across <CompanyName Class="Petitioner'> whilst inside <P><Text> tags I require this to find its way on import into Filemaker into a completely separate field labelled 'CompanyNamePetitioner'.
I'm really stuck on two fronts:
1. What to put in my XSLT to handle this - I guess some sort of 'if' statement.
2. How on import into Filemaker to 'split' out the text to either populate CompanyName field or CompanyNamePetitioner.
B. The second is really kind of similar: I have a tag in my XML file called <AddressLineGroup>. This tag will either appear inside of tags 'P/Text' or 'Administration/Administrator'. It can contain a number of attributes (<AddressLineGroup Class="Meeting">, <AddressLineGroup Class="Administrator">, <AddressLineGroup Class="Company"> and <AddressLineGroup Class="Petitioner">). Dependent on what the attribute is I need on import into Filemaker to split out into one of four fields:
If I encounter <AddressLineGroup Class="Meeting"> within the XML file, then on import into Filemaker the relevant text should find its way into field 'AddressMeeting'
If I encounter <AddressLineGroup Class="Administrator"> within the XML file, then on import into Filemaker the relevant text should find its way into field 'AddressAdministrator'
And so on . . .
I hope that this is OK and clear. Once again thanks for assistance.