Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8530333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:14:01+00:00 2026-06-11T09:14:01+00:00

I have a XSL that needs to filter out specific data found in the

  • 0

I have a XSL that needs to filter out specific data found in the XML.

Somewhere in my XML there will be a node like:

<id root="2.16.840.1.113883.3.51.1.1.6.1" extension="9494949494949" />

The XSL I have below deletes the extension node and adds a nullFlavor=”MSK” to the node.

What I need to do now, is take the value from the extension node, and search the entire XML document for that value, and replace it with **.

But I’m not sure how to take the extension attribute, and find all instances of that value in the XML (they could be burried in text and inside attributes) and turn them into ** (4 *).

The example below is just an example. I cannot hard code the XSL to look at specific nodes, it needs to look through all text / attribute text in the xml (reason for this is there are 5+ different versions of XML that this will be applied to).

I need to find the Extension in the node, then replace (delete really) that value from the rest of the XML. I’m looking for a 1 solution fits all messages, so a global search->wipe of the Extension value.

Example:

        <identifiedPerson classCode="IDENT">
                <id root="2.16.840.1.113883.3.51.1.1.6.1" extension="9494949494949" displayable="true" />
                <addr use="PHYS">
                    <city>KAMLOOPS</city>
                    <country>CA</country>
                    <postalCode>V1B3C1</postalCode>
                    <state>BC</state>
                    <streetAddressLine>1A</streetAddressLine>
                    <streetAddressLine>2A</streetAddressLine>
                    <streetAddressLine>9494949494949</streetAddressLine>
                    <streetAddressLine>4A</streetAddressLine>                        
                </addr>
                <note text="9494949494949 should be stars"/>

Should be (The below XSLT already masks the extension in the node with the matching OID).

            <identifiedPerson classCode="IDENT">
                <id root="2.16.840.1.113883.3.51.1.1.6.1" nullFlavor="MSK" displayable="true" />
                <addr use="PHYS">
                    <city>KAMLOOPS</city>
                    <country>CA</country>
                    <postalCode>V1B3C1</postalCode>
                    <state>BC</state>
                    <streetAddressLine>1A</streetAddressLine>
                    <streetAddressLine>2A</streetAddressLine>
                    <streetAddressLine>****</streetAddressLine>
                    <streetAddressLine>4A</streetAddressLine>                        
                </addr>
                <note text="**** should be stars"/>

Any help would be appreciated.

I am able to use XSL 2.0

I have the current XSL.IT works fine. It matches any tag where the root is ‘2.16.840.1.113883.3.51.1.1.6.1’, kills all attributes and adds a nullFlavor=”MSK”. However, this will not search the entire XML for that same #.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <xsl:param name="attrToKeep" select="'root'" />

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

    <xsl:template match="@*">
      <xsl:choose>
        <xsl:when test="../@root = '2.16.840.1.113883.3.51.1.1.6.1'">
          <xsl:copy-of select=".[contains($attrToKeep, name())]" />     
          <xsl:attribute name="nullFlavor">MSK</xsl:attribute>
          <!-- Need some way to use the value found in this node and hide the extension -->
        </xsl:when>
        <xsl:otherwise>
          <xsl:copy-of select="." />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>
</xsl:stylesheet>

Any help would be appreciated.

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:14:02+00:00Added an answer on June 11, 2026 at 9:14 am

    Try using a variable to hold the value of the text to be replaced. Like this:

    <xsl:variable
        name="rootVar"
        select="//*[@root = '2.16.840.1.113883.3.51.1.1.6.1']/@extension" />
    

    And then you should just be able to use the replace function to replace them.

    <xsl:template match="'//@*' | text()">
        <xsl:sequence select="replace(., $rootVar, '****')"/>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xml that looks like below <xsl:template match=//xml> <xsl:for-each select=//z:row> <ul class
I have got an XSLT that looks like this: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml
I have an xml column ExportTemplate in a table that holds an xsl template
I have the following code that applies a XSLT style Test.Xml.xslTransform = function(xml, xsl)
I have an XML file that I need to transform using an XSL script.
I have a piece of xml that looks like this: <root> <tag1>tractor</tag1> <tag2> <subtag1
Let's say I have an XML file that looks like this: <a id=x> <b>
I have XML that looks like <?xml version=1.0?> <ROWSET> <ROW> <AAA_ID>43238</AAA_ID> <BBB_ID>9</BBB_ID> <CCC_COURIER>2</CCC_COURIER> <CCC_FAX>33.44</CCC_FAX>
I have a xml that looks like below one. I need your help to
I have XML that looks like the following. <CONTAINER> <SEARCHFOR /> <ITEM/> <ITEM/> <ITEM/>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.