Jump to content
Server Maintenance This Week. ×

XSL assistance — "filtering" subsequent duplicates


nullbreached

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

Recommended Posts

  • Newbies

Sorry to add to the noise here with another "help me" post. It seems there are so many of us with XSL questions.

I am creating XML from Filemaker database that is essentially a calendar of events. There's an event parent with child elements like eventtitle, eventdate, etc. One such child is a category for the listing. I would like to process the XML so that the category remains on the first instance for an event and is "stripped" on subsequent repetitions. This is for placement in a layout application so that there are headers between each category but not with every event.

Can someone point me in the right direction?

I have attempted to do this at the source, from within Filemaker, with self-joins but I am having problems making it work in every instance because the joins really need to be based on calculated fields.

Link to comment
Share on other sites

  • 1 month later...
  • Newbies

XSL transforms are a very powerful way to convert XML data to HTML, XHTML, plain text. They are also excellent at filtering XML data or translating from one vocabulary (that is, a DTD or schema) to another. Writing the XSLT templates to perform the transformations, however, can be challenging. Just trying to figure out how to copy an XML document using XSLT (the identity transform) is a lot more difficult than you might expect.

Listed below are several templates that you may need when using eWebEditPro+XML. More Ektron knowledgebase articles on XSLT are available to give useful tips and help with common pitfalls. This article does not attempt to explain how XSLT templates or XPath pattern matching works. For an introduction to XSLT and XPath, please search the web or books on the subject. There are excellent resources readily available.

The Identity Transform

The most basic of all templates is the identity template or transform. This transform simply copies all the tags and attributes of the source document to the resulting document. The identity template is the basis for all transforms that filter the source by adding, removing or altering some tags and attributes, but passes the others through unchanged.

A word of caution, however, is appropriate. There are several aspects of an XML document that cannot be truly duplicated-at least not without significant effort. There are: the XML declaration, namespace nodes, the way empty tags are closed, and whitespace between tags.

The XML declaration

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

The XML declaration is the "<?xml ..." line typically found at the top of the XML document. Technically, this line is not really part of the document, but provided meta information about the document itself. The omit-xml-declaration can be used to control whether the declaration is output or not. You cannot, however, copy the encoding of the source document. The encoding must be specified in the xsl:output tag in the XSLT and the xsl:output tag does not accept variables. The only way to dynamically set the output encoding is to write an XSLT that creates and XSLT.

The xsl:output tag in the XSLT controls the XML declaration of the resulting XML document.

__________________________________________________

Want to get-on Google's first page and loads of traffic to your website? Hire a SEO specialist from Ocean Groups seo specialist

Link to comment
Share on other sites

This topic is 4992 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.