Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How to extract information within tag


This topic is 5897 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

Hi there,

I've setup an XSLT style sheet to import the contents of these XML branches into FM:

...

...

However I'd also like to import the id statements that are within the tags. How would I go about extending my XSLT style sheet?

Here is what I use, which aside from not importing the ids works perfectly well:

<?xml version="1.0" encoding="UTF-8"?>

0

Any input greatly appreciated!

Thx,

Edited by Guest
Posted

Those are called "attributes" (much like HTML). They are extracted by using the "@" sign. In this case you're already in their element's node, so you'd just use:


Posted

Hi Fenton,

works like a charm. Thanks!

If I may bother you with another question: The XML source consists of two blocks, the first one:

...

...

...

and the second one that I quoted before:

...

...

I've set up the import routine twice, so I need to import the two blocks seperatly from each other using two different XSLTs.

Is there a way to do the job using only one XSLT and therefore only one import routine? The content of the header block (name, type etc.) is on a different level (first level within the block) though than the content that I need to extract from the topics block (second level within the block).

Thanks again,

Posted

You can always access levels above the node that determines what a FileMaker record is, but using the "../" syntax in the path, like "../../header/name" (pseudo code, test yourself, it's easy to have the wrong number of ../). But the question is whether you should. It's more of a database structural question, since bringing both in at once effectively "flattens" hierarchal data, bringing the same header data into each FileMaker record, rather than importing it into a "parent" table. But it could bring in the parent ID in any case, which can be used to tie the tables' data together.

Posted

Hi Fenton,

you are perfectly right of course when saying that you loose the hierarchical structure of the data, but as of now (don't ask me why the customer chose to go that way) this is what the data should look like when imported into FileMaker.

However what is not intended is that every record of the child tree also has the data of the parent tree but the data should rather be imported into subsequent records within FileMaker. That means if the parent tree has got 3 records and the child tree 100 records after importing into FileMaker there should be 103 records.

Can something like this be accomplished (since in the end it means nothing else than triggering two import steps in FileMaker via XSLT)?

Best regards,

Posted

It's possible to do it all in one import, using a single stylesheet with multiple templates. Roughly, your main template would have (after METADATA):P


...

















Then two sub-templates would follow, something like:























...

Makes sure to leave empty COL elements in your sub-templates, so that your data maps to the correct fields.

This topic is 5897 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.