Transforms are applied in the order in which they are encountered in a file. The ordering can be used to simplify the matching portions of transforms.
Suppose all files delivered in /foo should have a default group of sys, except those files delivered in /foo/bar, which should have a default group of bin.
You could write a complex regular expression that matches all paths that begin with /foo except for paths that begin with /foo/bar. Using the ordering of transforms makes this matching much simpler.
When ordering default transforms, always go from most specific to most general. Otherwise the latter rules will never be used.
For this example, use the following two rules:
<transform file path=foo/bar/.* -> default group bin> <transform file path=foo/.* -> default group sys>
Using transforms to add an action using the matching method previously described would be difficult since you would need to find a pattern that matched each package delivered once and only once. The pkgmogrify tool creates synthetic actions to help with this issue. As pkgmogrify processes manifests, for each manifest that sets the pkg.fmri attribute, a synthetic pkg action is created by pkgmogrify. You can match against the pkg action as if it were actually in the manifest.
For example, suppose you wanted to add to every package an action containing the web site example.com, where the source code for the delivered software can be found. The following transform accomplishes that:
<transform pkg -> emit set info.source-url=http://example.com>