One pesky blank line in an XSLT transform -


i'm using xslt extract data trademark xml file patent , trademark office. it's okay, except 1 blank line. can rid of moderately ugly workaround, i'd know if there better way.

here's subset of xslt:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:tm="http://www.wipo.int/standards/xmlschema/trademarks" xmlns:pto="urn:us:gov:doc:uspto:trademark:status"> <xsl:output method="text" encoding="utf-8" /> <xsl:strip-space elements="*"/> <xsl:template match="tm:transaction"> <xsl:apply-templates select=".//tm:trademark"/> <xsl:apply-templates select=".//tm:applicantdetails"/> <xsl:apply-templates select=".//tm:markevent"/> </xsl:template>  <xsl:template match="tm:trademark"> markcurrentstatusdate,"<xsl:value-of select="normalize-space(tm:markcurrentstatusdate)"/>"<xsl:text/> applicationnumber,"<xsl:value-of select="normalize-space(tm:applicationnumber)"/>"<xsl:text/> applicationdate,"<xsl:value-of select="normalize-space(tm:applicationdate)"/>"<xsl:text/> registrationnumber,"<xsl:value-of select="normalize-space(tm:registrationnumber)"/>"<xsl:text/> registrationdate,"<xsl:value-of select="normalize-space(tm:registrationdate)"/>"<xsl:text/> <xsl:apply-templates select="tm:wordmarkspecification"/> <xsl:apply-templates select="tm:trademarkext"/> <xsl:apply-templates select="tm:publicationdetails"/> <xsl:apply-templates select="tm:representativedetails"/> </xsl:template>  <xsl:template match="tm:wordmarkspecification"> markverbalelementtext,"<xsl:value-of select="normalize-space(tm:markverbalelementtext)"/>"<xsl:text/> </xsl:template> 

it has few more templates, that's gist of it. blank line @ beginning of output, before data; don't other blank lines. circumvention combine 2 lines:

<xsl:template match="tm:trademark"> markcurrentstatusdate,"<xsl:value-of select="normalize-space(tm:markcurrentstatusdate)"/>"<xsl:text/> 

into single line:

<xsl:template match="tm:trademark">markcurrentstatusdate,"<xsl:value-of select="normalize-space(tm:markcurrentstatusdate)"/>"<xsl:text/> 

this works, , guess i'm okay if there's nothing better, seems inelegant , kludge me. none of other templates need treatment (e.g. tm:wordmarkspecification template or 6 after that)), , i'm confused why it's needed here. ideas?

because can see specific point in xslt that's inserting blank line, presume it's not helpful provide xml i'm testing on, if need see it, can @ https://tsdrapi.uspto.gov/ts/cd/casestatus/rn2178784/download.zip ; it's xml file in archive.

use @ beginning of template same trick using @ end of template chop stylesheet node tree empty <xsl:text/> instructions:

<xsl:template match="tm:trademark"> <xsl:text/>markcurrentstatusdate,"<xsl:value-of select="normalize-space(tm:markcurrentstatusdate)"/>"<xsl:text/> 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -