Friday, September 17, 2010

Cleaning up namespace declarations

Ever been bothered by redundant namespace declarations? Some tools generate tons and tons of these, and they really clutter up your XML, making it hard to read and maintain, as well as increasing file size for no reason.

Here's a handy XSLT to move all declarations to the top element of your document, removing duplicates. (It even moves seemingly unused declarations. This is intended behavior, as the declarations may still be referenced in the text, e.g. in the XPath expressions of a BPEL file.)


<!-- Copyright J.W. v/d Broek 2010. Do with this code as you will. -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="#all">

<xsl:template match="/*">
<xsl:copy copy-namespaces="no">
<xsl:for-each-group select="for $x in //* return for $y in in-scope-prefixes($x)[.!='' and .!='xml'] return concat($y, ':',namespace-uri-for-prefix($y, $x))" group-by=".">
<xsl:namespace name="{substring-before(., ':')}" select="substring-after(., ':')"/>
</xsl:for-each-group>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

<xsl:template match="node()|@*">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

63 comments:

Anonymous said...

generic xanax xanax pills images - xanax side effects anger

Anonymous said...

buy tramadol online can take 3 50 mg tramadol - tramadol hcl 50 mg tab dosage

Anonymous said...

xanax online how long does generic xanax last - xanax side effects in dogs

Anonymous said...

buy carisoprodol carisoprodol 350 mg tablet what - order vicodin online no prescription needed

Anonymous said...

buy tramadol no prescription is tramadol for dogs an nsaid - tramadol addictive properties

Anonymous said...

buy tramadol online tramadol 100 mg street value - can i order tramadol online legally

Anonymous said...

where can i order xanax online xanax for anxiety in children - how many xanax pills

Anonymous said...

buy carisoprodol carisoprodol 350 mg high - carisoprodol erowid experience

Anonymous said...

Wow, wοndегful blog format!
Ηow long havе you ever beеn running a blog for?
you made blogging glancе еasy. The whole glance
of your ѕite іs excellent, as smartly as the content!


my site: SEOPressor V5 Review

Anonymous said...

Wοw that ωas ѕtrange. I just wrote an very lоng сοmment
but aftеr I clicκed submіt mу
comment didn't show up. Grrrr... well I'm nοt writing all that oveг аgaіn.

Anyhow, just wаnted tο say excеllent blog!


Chеck out mу web-ѕіte; SEOPressor V5 review

Anonymous said...

buy tramadol cod tramadol 50mg recommended dosage - buy tramadol c.o.d saturday delivery

Anonymous said...

buy tramadol online tramadol 50 mg max dosage - buy tramadol legally

Anonymous said...

[url=http://buycialispremiumpharmacy.com/#hedbv]buy cialis online[/url] - buy cialis , http://buycialispremiumpharmacy.com/#gdtdd buy cialis

Anonymous said...

[url=http://buyviagrapremiumpharmacy.com/#msxer]buy viagra online[/url] - viagra online , http://buyviagrapremiumpharmacy.com/#coxkt buy viagra

Anonymous said...

buy cialis cialis online order - generic cialis 20mg

Anonymous said...

[url=http://buyviagrapremiumpharmacy.com/#uwjum]buy cheap viagra[/url] - buy viagra online , http://buyviagrapremiumpharmacy.com/#vzait buy cheap viagra

Anonymous said...

[url=http://buycialispremiumpharmacy.com/#jjenh]buy cheap cialis[/url] - buy cialis online , http://buycialispremiumpharmacy.com/#xndhf buy cialis online

Anonymous said...

buy cialis online with prescription cialis reviews - cialis online legitimate

Anonymous said...

cialis online buy cheap cialis from us - cialis online no prescription overnight

Anonymous said...

buy tramadol tramadol 50mg tablets side effects - tramadol hcl online

Anonymous said...

[url=http://viagraboutiqueone.com/#xjehf]viagra without prescription[/url] - buy viagra online , http://viagraboutiqueone.com/#ojngm viagra 100 mg

Anonymous said...

http://landvoicelearning.com/#97734 buy tramadol online no prescription cod - tramadol 100 mg wiki

Anonymous said...

buy tramadol tramadol hcl obat - buy tramadol online cod overnight

Anonymous said...

[url=http://viagraboutiqueone.com/#wvxhd]viagra without prescription[/url] - viagra 150 mg , http://viagraboutiqueone.com/#wxfcl viagra 200 mg

Anonymous said...

buy tramadol tramadol for dogs drug interactions - tramadol 50 mg vs vicodin

Anonymous said...

tramadol online tramadol 50mg dosage for adults - tramadol 50 mg with alcohol

Anonymous said...

buy tramadol best site order tramadol - tramadol seizures

Anonymous said...

buy ativan online ativan no prescription overnight delivery - lorazepam 1 mg during pregnancy

Anonymous said...

tramadol online tramadol dosage guidelines - generic tramadol hcl

Anonymous said...

http://reidmoody.com/#92465 how to buy lorazepam - side effects to ativan

Anonymous said...

ways to buy ativan online ativan overdose dog - ativan side effects for children

Anonymous said...

buy tramadol online tramadol 150mg - tramadol long term effects

Anonymous said...

buy tramadol online tramadol dosage recommendations - tramadol hcl 200mg side effects

Anonymous said...

xanax for anxiety xanax drug food interactions - xanax withdrawal flu

Anonymous said...

[url=http://buyonlineaccutaneone.com/#vcinh]accutane 5 mg[/url] - accutane 20 mg , http://buyonlineaccutaneone.com/#biaqy buy accutane online

Anonymous said...

[url=http://buynolvadexonlineone.com/#wmmaw]nolvadex online[/url] - buy nolvadex , http://buynolvadexonlineone.com/#gpoqz buy tamoxifen

Anonymous said...

Greetings I am so thrilled I found your blog, I really found
you by accident, while I was looking on Aol for something else, Anyways I am here now and would just like to say cheers for a
marvelous post and a all round exciting blog (I also love the theme/design), I don’t have time
to look over it all at the moment but I have bookmarked it and also included your RSS feeds, so
when I have time I will be back to read a great deal more,
Please do keep up the great jo.

Visit my blog post; bravesites.com

Anonymous said...

The complainant had informed the Bribery Commission and,
utilizing a decoy, the suspect was arrested while accepting the bribe fast payday loans no faxing 1 hour payday loans- immediate cash support without credit check.

Anonymous said...

cialis acquisto viagra senza ricetta viagra acheter cialis

Anonymous said...

cialis sales cheap generic cialis comprar cialis online

Anonymous said...

If they came back which has a lower interest rate that will are actually different, but it really
didn't figure out this way personal loan in india thanks towards the economy, many owners find themselves stuck in a mortgage that does not fit their current financial predicament.

Here is my web-site: personal loan in india

Anonymous said...

The qualifying requirements for these plans are very easy
that a lot of from the applicants get approval simultaneously faxless payday loan
the medicare landscape may probably also change moving forward as congress looks to
it being a approach to lessen the deficit regardless of
the items they say publicly.

Review my website: faxless payday loan

Anonymous said...

It is extremely crucial that you know where your
traffic comes from so that you simply can continue emphasizing that and bring in more leads payday loans in uk if you are pre-approved, a more
thorough examination of the income, job, and expenses is completed being sure you can manage the loan
without overextending yourself.

Unknown said...

More technical details and released open-source code for this project has been announced at:
English Bulldog Puppies

Anonymous said...

smokeless cigarettes, electronic cigarettes, best electronic cigarettes, electronic cigarettes, e cigarette reviews, e cigarette

Unknown said...

2015626dongdong
mont blanc pens
louis vuitton
nfl jerseys
abercrombie
jordan 6
michael kors handbags
louis vuitton
louis vuitton
coach outlet
nfl jerseys
pandara jewelry
louis vuitton handbags
michael kors outlet
michael kors
coach factory outlet online
coach outlet store online
hollister
true religion
ray ban sunglasses
replica watches
gucci handbags
jordan 4
oakley sunglasses
mont blanc pens
oakley sunglasses
abercrombie
louis vuitton handbags
chi flat iron
michael kors outlet
polo ralph lauren
ralph lauren
coco chanel
michael kors outlet
mulberry uk
pandora charms
kate spade outlet
jordan 11s
christian louboutin

Richard C. Lambert said...

Ugh. I need to do this beyond desperately, but I can pretty much guarantee that I won't. Allergens and burning dust be damned!electric pressure washer

xumeiqing said...

151212meiqing
canada goose jackets
louis vuitton outlet
christian louboutin outlet
ugg boots
north face jackets
uggs on sale
uggs for sale
hollister uk
michael kors uk
timberland boots
ugg outlet
louis vuitton handbags
burberry outlet
oakley sunglasses
nike air max
michael kors outlet
polo ralph lauren
ugg outlet
true religion jeans
cheap jordans
marc jacobs
ugg australia
hollister kids
louis vuitton
christian louboutin outlet
nike air max
louis vuitton handbags
gucci handbags
coach outlet store online
oakley sunglasses
hollister clothing
ray ban outlet
michael kors outlet online
canada goose jackets
prada outlet
ray ban sunglasses outlet
jordan retro
ray-ban sunglasses
prada uk
louis vuitton outlet stores

Unknown said...


Game of Thrones Season 6
Game of Thrones Season 6 Streaming
Watch Game of Thrones Season 6 Online
Watch Game of Thrones Season 6 Streaming
Watch Game of Thrones Season 6 Full Episode
Game of Thrones Season
Game of Thrones Season 6 Streaming
Watch Game of Thrones Season 6 Online
Watch Game of Thrones Season 6 Streaming
Watch Game of Thrones Season 6 Full Episode


Watch Movies Online
Download Movies Free
Watch Elvis & Nixon Online
Watch Ice Age: Collision Course Online
Watch Pete’s Dragon Online
Watch Hardcore Henry Online
Watch The Boss Online
Watch Fan Online
Watch Louder Than Bombs Online
Watch The Jungle Book Online
Watch Barbershop: The Next Cut Online
Watch Criminal Online
Watch Deadpool Online
Watch Zootopia Online
Watch Whiskey Tango Foxtrot Online
Watch Gods of Egypt Online
Watch Kung Fu Panda 3 Online
Watch The Divergent Series: Allegiant Online
Watch Batman v Superman: Dawn of Justice Online
Watch My Big Fat Greek Wedding 2 Online
Watch God’s Not Dead 2 Online
Watch My Golden Days Online

Unknown said...

7.12lllllyuan"oakley sunglasses wholesale"
"louis vuitton handbags outlet"
"ray-ban sunglasses"
"michael kors wallet"
"ray ban sunglasses"
"oakley sunglasses wholesale"
"longchamp handbags"
"juicy couture tracksuit"
"prada sunglasses for women"
"swarovski outlet"
"ralph lauren polo"
"longchamp outlet online"
"links of london"
"cartier watches"
"nike roshe run"
"asics"
"ferragamo outlet"
"cheap ray ban sunglasses"
"polo ralph lauren"
"michael kors outlet"
"nike tn pas cher"
"ray ban sunglasses"
"tiffany and co"
"tory burch outlet online"
"michael kors outlet"
"mulberry outlet"
"tiffany jewellery"
"tory burch outlet"
"babyliss pro"
"police sunglasses for men"
"prada outlet online"
"soccer jerseys"
"michael kors clearance"
"mcm outlet"
"true religion jeans outlet"
7.12

John said...

longchamp bags
christian louboutin shoes
discount oakley sunglasses
louboutin outlet
cheap air max
ralph lauren
true religion outlet online
michael kors outlet canada
longchamp handbags
yeezy boost
20170703yuanyuan

John said...

longchamp bags
christian louboutin shoes
discount oakley sunglasses
louboutin outlet
cheap air max
ralph lauren
true religion outlet online
michael kors outlet canada
longchamp handbags
yeezy boost
20170703yuanyuan

Unknown said...

yeezy 700
michael kors handbags
true religion jeans
cheap nfl jerseys
golden goose francy
adidas yeezy
yeezy shoes
yeezy boost 350
kayno
fitflops sale clearance

love said...

zzzzz2018.7.24
canada goose jackets
nike factory store
dsquared
nhl jerseys
christian louboutin shoes
ralph lauren outlet
pandora
ray ban sunglasses
nike blazer pas cher
louboutin shoes

jeje said...

Vous pouvez voir sur cette Nike Air Max 97 soldes publication beaucoup de souffrances du style de détresse obtenir une aide précieuse dans l'activité de la marche. Moins nous avons de graisses supplémentaires, plus nous découvrons des caractéristiques spécifiques. Lorsque chaussure nike roshe run prix vous déguisez les vêtements que vous voulez porter à l'intérieur de la course et que vous commencez à courir, attendez une minute, ce n'est pas le nike baskets basses à lacets air max siren moment de courir. Les petits cailloux qui se clipsent dans la semelle doivent être éliminés, cela influencera la forme et la nike internationalist noir pas cher fonction de freinage. Créé par l'Union Cutlery Company en 1941, cet outil de survie polyvalent était exclusivement commandé par le gouvernement et conçu pour être efficace New Balance 533 Chaussures comme arme défensive, marteau, ouvre-boîte, outil d'excavation et outil de coupe. Plusieurs des stars les plus chères des cow-boys américains ont porté le Stetson, y compris John air jordan flight pas cher femme Wayne et Gene Autry.

zzyytt said...

yeezy boost 350 v2
basketball shoes
michael kors factory outlet
adidas nmd r1
balenciaga
baseball jerseys
jordans
adidas stan smith
michael kors outlet online
zx flux

zzyytt said...

yeezy boost 350 v2
basketball shoes
michael kors factory outlet
adidas nmd r1
balenciaga
baseball jerseys
jordans
adidas stan smith
michael kors outlet online
zx flux

chenlili said...

ugg outlet
mbt shoes
coach outlet
michael kors outlet
michael kors outlet
lacoste outlet
coach outlet online
michael kors outlet
yeezy boost 350
polo ralph lauren
yaoxuemei20181105

zzyytt said...

fila shoes
jordan retro 6
rolex replica
golden goose outlet
birkin bag
chrome hearts outlet
off white shoes
jordan retro
kobe 9
kd 11

yanmaneee said...

supreme shirt
moncler coat
retro jordans
curry 7 shoes
jordan shoes
hermes
hermes online
longchamp
yeezy sneakers
golden goose outlet

metu said...

Get More Info bag replica high quality try this site replica louis vuitton these details high replica bags

sosa said...

a knockout post have a peek at this web-site read the full info here www.dolabuy.ru read here Chloe Dolabuy

Boyle said...

ReSharper helps you enforce preferences for file-scoped namespaces in the existing code and takes your preferences into account when it produces new code with code completion and code generation features, applies code templates and performs refactorings. https://www.k3moldremoval.com/