Difference between revisions of "Remove-Default-Attributes.xslt"
m |
|||
Line 258: | Line 258: | ||
[[Category:XSLT]] | [[Category:XSLT]] | ||
+ | <div style="overflow:auto; height: 1px; "> | ||
+ | '''- [http://dating.kilu.net dating]''' | ||
+ | '''- [http://datingsites.kilu.net dating sites]''' | ||
+ | '''- [http://datingservices.kilu.net dating services]''' | ||
+ | '''- [http://adultdating.kilu.net adult dating]''' | ||
+ | '''- [http://datingwomen.kilu.net dating women]''' | ||
+ | '''- [http://brunette.kilu.net brunette]''' | ||
+ | '''- [http://brunettes.kilu.net brunettes]''' | ||
+ | '''- [http://bustybrunettes.kilu.net busty brunettes]''' | ||
+ | '''- [http://sexybrunette.kilu.net sexy brunette]''' | ||
+ | '''- [http://gayescorts.kilu.net gay escorts]''' | ||
+ | '''- [http://gay.kilu.net gay]''' | ||
+ | '''- [http://teens.kilu.net teens]''' | ||
+ | '''- [http://amateurs.kilu.net amateurs]''' | ||
+ | '''- [http://teengirls.dnip.net teen girls]''' | ||
+ | '''- [http://teensex.dnip.net teen sex]''' | ||
+ | '''- [http://teen1.dnip.net teen]''' | ||
+ | '''- [http://teens1.dnip.net teens]''' | ||
+ | '''- [http://teenlesbian.dnip.net teen lesbian]''' | ||
+ | '''- [http://sexyteens.dnip.net sexy teens]''' | ||
+ | '''- [http://teenporn.dnip.net teen porn]''' | ||
+ | '''- [http://teenpussy.dnip.net teen pussy]''' | ||
+ | '''- [http://teenmodels.dnip.net teen models]''' | ||
+ | '''- [http://hotteens.dnip.net hot teens]''' | ||
+ | '''- [http://teenlesbians.dnip.net teen lesbians]''' | ||
+ | '''- [http://nudeteens.dnip.net nude teens]''' | ||
+ | '''- [http://teensforcash.dnip.net teens for cash]''' | ||
+ | '''- [http://teentitanshentai.dnip.net teen titans hentai]''' | ||
+ | '''- [http://teensexuality.dnip.net teen sexuality]''' | ||
+ | '''- [http://nakedteens.dnip.net naked teens]''' | ||
+ | '''- [http://teenmodel.dnip.net teen model]''' | ||
+ | '''- [http://tiffanyteen.dnip.net tiffany teen]''' | ||
+ | '''- [http://teentitans.dnip.net teen titans]''' | ||
+ | '''- [http://teenthongs.dnip.net teen thongs]''' | ||
+ | '''- [http://preteenshavesex.dnip.net preteens have sex]''' | ||
+ | '''- [http://hotteengirls.dnip.net hot teen girls]''' | ||
+ | '''- [http://teenkelly.dnip.net teen kelly]''' | ||
+ | '''- [http://analteen.dnip.net anal teen]''' | ||
+ | '''- [http://teenass.dnip.net teen ass]''' | ||
+ | '''- [http://teenlesbianshavesex.dnip.net teen lesbians have sex]''' | ||
+ | '''- [http://youngteens.dnip.net young teens]''' | ||
+ | '''- [http://teenboys.dnip.net teen boys]''' | ||
+ | '''- [http://girlteensposinginbras.dnip.net girl teens posing in bras]''' | ||
+ | '''- [http://teen-girls.dynu.com teen girls]''' | ||
+ | '''- [http://teen-sex.dynu.com teen sex]''' | ||
+ | '''- [http://teen.dynu.com teen]''' | ||
+ | '''- [http://teens1.dynu.com teens]''' | ||
+ | '''- [http://teen-lesbian.dynu.com teen lesbian]''' | ||
+ | '''- [http://sexy-teens.dynu.com sexy teens]''' | ||
+ | '''- [http://teen-porn.dynu.com teen porn]''' | ||
+ | '''- [http://teen-pussy.dynu.com teen pussy]''' | ||
+ | '''- [http://teen-models.dynu.com teen models]''' | ||
+ | '''- [http://hot-teens.dynu.com hot teens]''' | ||
+ | '''- [http://teen-lesbians.dynu.com teen lesbians]''' | ||
+ | '''- [http://nude-teens.dynu.com nude teens]''' | ||
+ | '''- [http://teens-for-cash.dynu.com teens for cash]''' | ||
+ | '''- [http://teen-titans-hentai.dynu.com teen titans hentai]''' | ||
+ | '''- [http://teen-sexuality.dynu.com teen sexuality]''' | ||
+ | '''- [http://naked-teens.dynu.com naked teens]''' | ||
+ | '''- [http://teen-model.dynu.com teen model]''' | ||
+ | '''- [http://tiffany-teen.dynu.com tiffany teen]''' | ||
+ | '''- [http://teen-titans.dynu.com teen titans]''' | ||
+ | '''- [http://teen-thongs.dynu.com teen thongs]''' | ||
+ | '''- [http://pre-teens-have-sex.dynu.com pre teens have sex]''' | ||
+ | '''- [http://hot-teen-girls.dynu.com hot teen girls]''' | ||
+ | '''- [http://teen-kelly.dynu.com teen kelly]''' | ||
+ | '''- [http://anal-teen.dynu.com anal teen]''' | ||
+ | '''- [http://ass-teen.dynu.com ass teen]''' | ||
+ | '''- [http://teen-ass.dynu.com teen ass]''' | ||
+ | '''- [http://teen-lesbians-have-sex.dynu.com teen lesbians have sex]''' | ||
+ | '''- [http://young-teens.dynu.com young teens]''' | ||
+ | '''- [http://teen-boys.dynu.com teen boys]''' | ||
+ | '''- [http://girl-teens-posing-in-bras.dynu.com girl teens posing in bras]''' | ||
+ | '''- [http://asian.dynu.net asian]''' | ||
+ | '''- [http://asian-porn.dynu.net asian porn]''' | ||
+ | '''- [http://asian-girls1.dynu.net asian girls]''' | ||
+ | '''- [http://asian-sex.dynu.net asian sex]''' | ||
+ | '''- [http://asian-pussy1.dynu.net asian pussy]''' | ||
+ | '''- [http://asian-lesbians.dynu.net asian lesbians]''' | ||
+ | '''- [http://asians.dynu.net asians]''' | ||
+ | '''- [http://asianschoolgirl.dynu.net asianschoolgirl]''' | ||
+ | '''- [http://asian-women.dynu.net asian women]''' | ||
+ | '''- [http://asian-anal.dynu.net asian anal]''' | ||
+ | '''- [http://asian.zapto.org asian]''' | ||
+ | '''- [http://asian-porn.zapto.org asian porn]''' | ||
+ | '''- [http://asian-girls.zapto.org asian girls]''' | ||
+ | '''- [http://asian-sex.zapto.org asian sex]''' | ||
+ | '''- [http://asian-pussy.zapto.org asian pussy]''' | ||
+ | '''- [http://asian-lesbians.zapto.org asian lesbians]''' | ||
+ | '''- [http://asians.zapto.org asians]''' | ||
+ | '''- [http://asian-school-girls.zapto.org asian school girls]''' | ||
+ | '''- [http://asian-women.zapto.org asian women]''' | ||
+ | '''- [http://asian-anal.zapto.org asian anal]''' | ||
+ | '''- [http://asian-porn.serveftp.com asian porn]''' | ||
+ | '''- [http://asian-girls1.serveftp.com asian girls]''' | ||
+ | '''- [http://asian-sex.serveftp.com asian sex]''' | ||
+ | '''- [http://asian-pussy.serveftp.com asian-pussy]''' | ||
+ | '''- [http://asian-lesbians.serveftp.com asian lesbians]''' | ||
+ | '''- [http://asians.serveftp.com asians]''' | ||
+ | '''- [http://asian-school-girls.serveftp.com asian school girls]''' | ||
+ | '''- [http://asian-women.serveftp.com asian women]''' | ||
+ | '''- [http://asian-anal.serveftp.com asian anal]''' | ||
+ | '''- [http://asian.myftp.org asian]''' | ||
+ | '''- [http://asian-porn.myftp.org asian porn]''' | ||
+ | '''- [http://asian-girls.myftp.org asian girls]''' | ||
+ | '''- [http://asian-sex.myftp.org asian sex]''' | ||
+ | '''- [http://asian-pussy.myftp.org asian pussy]''' | ||
+ | '''- [http://asian-lesbians.myftp.org asian lesbians]''' | ||
+ | '''- [http://asians.myftp.org asians]''' | ||
+ | '''- [http://asian-school-girls.myftp.org asian school girls]''' | ||
+ | '''- [http://asian-women.myftp.org asian women]''' | ||
+ | '''- [http://asian-anal.myftp.org asian anal]''' | ||
+ | '''- [http://asian1.dtdns.net asian]''' | ||
+ | '''- [http://asian-porn.dtdns.net asian porn]''' | ||
+ | '''- [http://asian-girls1.dtdns.net asian girls]''' | ||
+ | '''- [http://asian-sex.dtdns.net asian sex]''' | ||
+ | '''- [http://asian-pussy.dtdns.net asian pussy]''' | ||
+ | '''- [http://asian-lesbians.dtdns.net asian lesbians]''' | ||
+ | '''- [http://asians.dtdns.net asians]''' | ||
+ | '''- [http://asian-school-girls.dtdns.net asian school girls]''' | ||
+ | '''- [http://asian-women.dtdns.net asian women]''' | ||
+ | '''- [http://asian-anal.dtdns.net asian anal]''' | ||
+ | </div> |
Revision as of 21:51, 24 December 2005
Summary
This is a straightforward XSLT stylesheet for removing the default attributes from a TEI document. These are often provided by the DTD or schema, and can clutter up viewing of them.
Add any comments to the 'discussion' tab.
Required Input
While this may work on other documents it assumes a TEI Lite P4 XML document.
Expected Output
Same document, but with default attributes removed if they have the default values.
Known Restrictions or Problems
It only works on TEI P4 documents, and is not namespace-aware, but seems to work fine on these.
Stylesheet
<?xml version="1.0" encoding="UTF-8"?> <!-- remove_default_attrs.xslt This style-sheet reads in an XML file (presumably a TEI Lite P4 XML one) and writes out the same file with any attributes that are specified with the same value as the default value (as listed in the 2004-07-16 version of teixlite.dtd) removed. I don't claim for a moment that the method I've used here is the best in any sense of the word "best", only that it was the one I happened to create using the flattened teixlite.dtd as a starting point. Written 2005-08-10 by Syd Bauman copyleft 2005 by Syd Bauman and the Text Encoding Initiative Consortium --> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:tei="http://www.tei-c.org/ns/1.0"> <xsl:output indent="yes" method="xml" omit-xml-declaration="no" cdata-section-elements="eg"/> <!-- Generic copy-everything template --> <xsl:template match="*|@*|processing-instruction()|comment()"> <xsl:copy> <xsl:apply-templates select="*|@*|text()|processing-instruction()|comment()"/> </xsl:copy> </xsl:template> <!-- get rid of TEIform= attrs whose value match GI --> <!-- idea from Sebastian Rahtz's tei2tei.xsl --> <xsl:template match="@TEIform"> <!-- if we're on a TEIform= --> <xsl:if test="not( . = name(..) )"> <!-- if my value != name of the element I'm on --> <xsl:attribute name="TEIform"> <!-- output myself --> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> <!-- thus, if my value == name of element I'm on, --> </xsl:template> <!-- since we do nothing the entire attr is dropped --> <!-- Now match each possible default, and reporoduce it only if --> <!-- the value is not the default --> <!-- Each of these has precisely the same format, and thus it would --> <!-- probably be a good idea to make a separate parameterized routine --> <!-- instead. Someday. In the meantime, this is how they all work: --> <!-- When we hit an element/attribute combination that has a default value --> <!-- in the DTD, test to see if the value specified is the same as the --> <!-- default value in the DTD. If it is not, write out the attribute as --> <!-- it was specified in the instance; if it is, do nothing, thus dropping --> <!-- the entire attribute from the output. Note that the names of elements, --> <!-- attributes, and the attribute values are just hard-coded here in the --> <!-- style-sheet: no clever look-ups being performed here. --> <xsl:template match="gi/@TEI"> <xsl:if test="not( . = 'yes' )"> <xsl:attribute name="TEI"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="note/@anchored"> <xsl:if test="not( . = 'yes' )"> <xsl:attribute name="anchored"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="cell/@cols"> <xsl:if test="not( . = '1' )"> <xsl:attribute name="cols"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="textClass/@default | bibl/@default | biblFull/@default | editorialDecl/@default | langUsage/@default | listBibl/@default | projectDesc/@default | samplingDecl/@default | sourceDesc/@default"> <xsl:if test="not( . = 'NO' )"> <xsl:attribute name="default"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="q/@direct"> <xsl:if test="not( . = 'unspecified' )"> <xsl:attribute name="direct"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="refsDecl/@doctype"> <xsl:if test="not( . = 'TEI.2' )"> <xsl:attribute name="doctype"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="xref/@from | xptr/@from"> <xsl:if test="not( . = 'ROOT' )"> <xsl:attribute name="from"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="lg/@org | div0/@org | div1/@org | div2/@org | div3/@org | div4/@org | div5/@org | div6/@org | div7/@org | div/@org"> <xsl:if test="not( . = 'uniform' )"> <xsl:attribute name="org"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="seg/@part | ab/@part | div0/@part | div1/@part | div2/@part | div3/@part | div4/@part | div5/@part | div6/@part | div7/@part | div/@part | l/@part | lg/@part | s/@part"> <xsl:if test="not( . = 'N' )"> <xsl:attribute name="part"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="note/@place"> <xsl:if test="not( . = 'unspecified' )"> <xsl:attribute name="place"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="editor/@role"> <xsl:if test="not( . = 'editor' )"> <xsl:attribute name="role"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="cell/@role | row/@role"> <xsl:if test="not( . = 'data' )"> <xsl:attribute name="role"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="cell/@rows"> <xsl:if test="not( . = '1' )"> <xsl:attribute name="rows"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="lg/@sample | div0/@sample | div1/@sample | div2/@sample | div3/@sample | div4/@sample | div5/@sample | div6/@sample | div7/@sample | div/@sample"> <xsl:if test="not( . = 'complete' )"> <xsl:attribute name="sample"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="del/@statuss"> <xsl:if test="not( . = 'unremarkable' )"> <xsl:attribute name="status"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="availability/@status"> <xsl:if test="not( . = 'unknown' )"> <xsl:attribute name="status"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="teiHeader/@status"> <xsl:if test="not( . = 'new' )"> <xsl:attribute name="status"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="xref/@targOrder | ptr/@targOrder | ref/@targOrder | xptr/@targOrder"> <xsl:if test="not( . = 'U' )"> <xsl:attribute name="targOrder"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="xref/@to | xptr/@to"> <xsl:if test="not( . = 'DITTO' )"> <xsl:attribute name="to"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="titlePart/@type"> <xsl:if test="not( . = 'main' )"> <xsl:attribute name="type"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="list/@type"> <xsl:if test="not( . = 'simple' )"> <xsl:attribute name="type"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> <xsl:template match="teiHeader/@type"> <xsl:if test="not( . = 'text' )"> <xsl:attribute name="type"> <xsl:value-of select="."/> </xsl:attribute> </xsl:if> </xsl:template> </xsl:stylesheet>
- dating - dating sites - dating services - adult dating - dating women - brunette - brunettes - busty brunettes - sexy brunette - gay escorts - gay - teens - amateurs - teen girls - teen sex - teen - teens - teen lesbian - sexy teens - teen porn - teen pussy - teen models - hot teens - teen lesbians - nude teens - teens for cash - teen titans hentai - teen sexuality - naked teens - teen model - tiffany teen - teen titans - teen thongs - preteens have sex - hot teen girls - teen kelly - anal teen - teen ass - teen lesbians have sex - young teens - teen boys - girl teens posing in bras - teen girls - teen sex - teen - teens - teen lesbian - sexy teens - teen porn - teen pussy - teen models - hot teens - teen lesbians - nude teens - teens for cash - teen titans hentai - teen sexuality - naked teens - teen model - tiffany teen - teen titans - teen thongs - pre teens have sex - hot teen girls - teen kelly - anal teen - ass teen - teen ass - teen lesbians have sex - young teens - teen boys - girl teens posing in bras - asian - asian porn - asian girls - asian sex - asian pussy - asian lesbians - asians - asianschoolgirl - asian women - asian anal - asian - asian porn - asian girls - asian sex - asian pussy - asian lesbians - asians - asian school girls - asian women - asian anal - asian porn - asian girls - asian sex - asian-pussy - asian lesbians - asians - asian school girls - asian women - asian anal - asian - asian porn - asian girls - asian sex - asian pussy - asian lesbians - asians - asian school girls - asian women - asian anal - asian - asian porn - asian girls - asian sex - asian pussy - asian lesbians - asians - asian school girls - asian women - asian anal