XML Skeletons

I often need to write an XML file and can never quite remember the exact syntax. So here, as much for my own record as anything else, are some skeletons.

XML, with entities (in internal / embedded DTD) and a link to an XSLT stylesheet:

<?xml version="1.0" ?>
<!DOCTYPE dtd_for_root [
  <!ENTITY nbsp "& #160;">
]>
<?xml-stylesheet
  type="text/xsl"
  href="stylesheet-name.xsl"
  ?>
<root>
  <!-- etc. -->
</root>

XSLT:

<?xml version="1.0" ?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0"
  >
<xsl:template match="/">
  <!-- root template -->
</xsl:template>
<!-- etc. -->
<xsl:template match="*|text()"/>
<!-- ignore all else -->
</xsl:stylesheet>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: